Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Connecting to a sentinel Redis 5.0.7 fails with NOAUTH Authentication required #18

Closed
kalyashov opened this issue Aug 13, 2020 · 2 comments

Comments

@kalyashov
Copy link

kalyashov commented Aug 13, 2020

I am trying to connect to the sentinel node of a Redis and I am getting the error:

Caused by: io.lettuce.core.RedisConnectionException: null
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:75) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]
	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:242) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]
	at com.redislabs.lettusearch.RediSearchClient.connect(RediSearchClient.java:101) ~[lettusearch-2.3.2.jar:na]
	at com.redislabs.lettusearch.RediSearchClient.connect(RediSearchClient.java:94) ~[lettusearch-2.3.2.jar:na]
	at ru.vtb.payments.catalog.config.datasouce.RedisConfig.rediSearchReactiveCommands(RedisConfig.kt:27) ~[main/:na]
	at ru.vtb.payments.catalog.config.datasouce.RedisConfig$$EnhancerBySpringCGLIB$$7f1572ea.CGLIB$rediSearchReactiveCommands$1(<generated>) ~[main/:na]
	at ru.vtb.payments.catalog.config.datasouce.RedisConfig$$EnhancerBySpringCGLIB$$7f1572ea$$FastClassBySpringCGLIB$$173fceee.invoke(<generated>) ~[main/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	at ru.vtb.payments.catalog.config.datasouce.RedisConfig$$EnhancerBySpringCGLIB$$7f1572ea.rediSearchReactiveCommands(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
	... 82 common frames omitted
Caused by: io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.  
	at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:135) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]
	at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:108) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]
	at io.lettuce.core.RedisPublisher$SubscriptionCommand.complete(RedisPublisher.java:764) ~[lettuce-core-5.3.3.RELEASE.jar:5.3.3.RELEASE]

docker-compose.yml to launch redis containers:

version: '2'

networks:
  app-tier:
    driver: bridge

services:
  redis:
    image: 'redislabs/redisearch:latest'
    environment:
      - REDIS_PASSWORD=12345678
    ports:
      - '6379:6379'
    networks:
      - app-tier
  redis-sentinel:
    image: 'bitnami/redis-sentinel:latest'
    environment:
      - REDIS_MASTER_HOST=127.0.0.1
      - REDIS_MASTER_PASSWORD=12345678
      - REDIS_SENTINEL_PASSWORD=12345678
    ports:
      - '26379:26379'
    networks:
      - app-tier

The settings in the spring-boot app to connect Redis:

  redis:
    port: 6379
    database: 0
    host: localhost
    mutex-timeout: 300s
    command-timeout: 10s
    sentinel:
      master: mymaster
      nodes: 127.0.0.1:26379
      password: 12345678
    password: 12345678

I see that the redisURI in the RediSearchClient is formed correctly
image

I also see a connection that is formed in the RediSearchClient, it does not contain a password, what is this password?
I tried to set it in debug, but the authentication error remained.
image

The password to Redis is correct:
image
I checked that the password to Redis is correct and also when I configure sentinel Redis without password there are no connection errors.

I see similar issues:

@kalyashov kalyashov changed the title Connecting to a sentinel Redis 5.0.7 server fails with NOAUTH Authentication required Connecting to a sentinel Redis 5.0.7 fails with NOAUTH Authentication required Aug 13, 2020
@kalyashov
Copy link
Author

I think that problem in RediSearchClient, this is my modified RediSearchClient, which is successfully connected to redis sentintel.
I copied RedisClient from lettuce and changed the interfaces, but I haven't found the exact location of the problem yet

RediSearchClient.zip

@jruaux
Copy link
Collaborator

jruaux commented Aug 27, 2020

Thank you for reporting the issue and submitting the fix. I incorporated this in v2.4.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants