You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring boot version: 2.2.6.RELEASE
I get the RedisCommandExecutionException: NOAUTH Authentication required. After setting the configuration like this:
I tried setting only spring.redis.password, only spring.redis.sentinel.password and both at the same time and it's not working.
Digging through the code I found that the sentinel password is never set on the configuration:
1- org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel doesn't have the 'password' property.
2- org.springframework.boot.autoconfigure.data.redis.RedisConnectionConfiguration#getSentinelConfig() never sets the existing property 'sentinelPassword' in RedisSentinelConfiguration.
3 - Resulting in the org.springframework.data.redis.connection.lettuce.LettuceConverters setting always a null password which is the default when not set in the sentinelConfigurationToRedisURI method.
So the problem comes when the sentinel is also password protected. I mistakenly filed the bug on the Spring redis data and they sent me here.
Based on some comments from #18942, we didn't surface a property for spring.redis.sentinel.password because Sentinel authentication was only supported by Lettuce and not by Jedis.
@mp911de What are your thoughts on surfacing a property that applies to one driver and not the other?
Back then, Jedis didn't provide an option to configure the Sentinel password. In the meantime, Jedis provided the required functionality so I filed DATAREDIS-1145 to support Sentinel passwords with Jedis in Spring Data Redis.
That being said, it makes sense to surface the password property in the spring.redis.sentinel namespace.
We've tried a similar approach in Spring Data Redis and learned that we should not couple the Redis password to the Sentinel password. The Sentinel password was added in a later Redis version so earlier Redis setups will fail when the Sentinel password is set to the Redis password.
@mp911de Interesting. We currently have code that sets the sentinel password to the redis one and we were worried about back compatibility. After discussing it some more, we'll just add a new property and make the user set it if they want to use the same value.
Looking at the code further, I don't think there's a back compatibility issue as we've never set the sentinelPassword. Even in the RedisSentinelConfiguration, it was the dataNodePassword that we configured.
Activity
mbhave commentedon May 8, 2020
This is the Spring Data issue for reference.
Based on some comments from #18942, we didn't surface a property for
spring.redis.sentinel.passwordbecause Sentinel authentication was only supported by Lettuce and not by Jedis.@mp911de What are your thoughts on surfacing a property that applies to one driver and not the other?
mcanessa commentedon May 8, 2020
Hello, i found this Jedis merge.
mp911de commentedon May 11, 2020
Back then, Jedis didn't provide an option to configure the Sentinel password. In the meantime, Jedis provided the required functionality so I filed DATAREDIS-1145 to support Sentinel passwords with Jedis in Spring Data Redis.
That being said, it makes sense to surface the password property in the
spring.redis.sentinelnamespace.[-]Redis auto configuration fails to set sentinel password[/-][+]Add Redis sentinel password property[/+][-]Add Redis sentinel password property[/-][+]Add redis sentinel password property[/+]philwebb commentedon May 13, 2020
mp911de commentedon May 13, 2020
We've tried a similar approach in Spring Data Redis and learned that we should not couple the Redis password to the Sentinel password. The Sentinel password was added in a later Redis version so earlier Redis setups will fail when the Sentinel password is set to the Redis password.
philwebb commentedon May 13, 2020
@mp911de Interesting. We currently have code that sets the sentinel password to the redis one and we were worried about back compatibility. After discussing it some more, we'll just add a new property and make the user set it if they want to use the same value.
mbhave commentedon May 13, 2020
Looking at the code further, I don't think there's a back compatibility issue as we've never set the
sentinelPassword. Even in theRedisSentinelConfiguration, it was thedataNodePasswordthat we configured.