Skip to content

Add redis sentinel password property #21353

Closed

Description

@mcanessa

Spring boot version: 2.2.6.RELEASE
I get the RedisCommandExecutionException: NOAUTH Authentication required. After setting the configuration like this:

spring:
  cache:
    cache-names: mycache
    type: redis
  redis:
    password: mypassword
    sentinel:
      master: mymaster
      password: mypassword
      nodes: myredis01:26379,myredis02:26379,myredis03:2637{code}

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.

regards,

Activity

  1. added
    status: waiting-for-triage
    on May 7, 2020
  2. mbhave commented on May 8, 2020

    @mbhave
    Contributor

    This is the Spring Data issue for reference.

    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?

  3. mcanessa commented on May 8, 2020

    @mcanessa
    Author

    Hello, i found this Jedis merge.

  4. added
    status: waiting-for-feedback
    on May 8, 2020
  5. mp911de commented on May 11, 2020

    @mp911de
    Member

    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.

  6. added
    status: feedback-provided
    and removed
    status: waiting-for-feedback
    on May 11, 2020
  7. added
    type: enhancement
    and removed
    status: feedback-provided
    status: waiting-for-triage
    on May 11, 2020
  8. added this to the milestone on May 11, 2020
  9. added
    for: team-attention
    on May 12, 2020
  10. added
    status: blocked
    and removed
    status: blocked
    for: team-attention
    on May 13, 2020
  11. changed the title [-]Redis auto configuration fails to set sentinel password[/-] [+]Add Redis sentinel password property[/+] on May 13, 2020
  12. changed the title [-]Add Redis sentinel password property[/-] [+]Add redis sentinel password property[/+] on May 13, 2020
  13. philwebb commented on May 13, 2020

    @philwebb
  14. mp911de commented on May 13, 2020

    @mp911de
    Member

    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.

  15. philwebb commented on May 13, 2020

    @philwebb
    Member

    @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.

  16. added
    for: upgrade-attention
    and removed
    for: upgrade-attention
    on May 13, 2020
  17. mbhave commented on May 13, 2020

    @mbhave
    Contributor

    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.

  18. modified the milestones: , 2.3.0 on May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions