NOAUTH HELLO must be called with the client already authenticated #2303
Replies: 3 comments 2 replies
-
Please set the protocol version to RESP2 (using ClientOptions) to avoid HELLO commands with Sentinel. Sentinel had for quite a time a broken HELLO implementation. |
Beta Was this translation helpful? Give feedback.
-
So the connection to sentinel works, but the connection to the radis drops :( @Bean
public RedisURI redisUri(RedisProperties redisProperties) {
RedisURI redisURI = RedisURI.Builder
.sentinel(redisProperties.getHost1(), redisProperties.getPort1())
.withSentinel(redisProperties.getHost2(), redisProperties.getPort2())
.withSentinel(redisProperties.getHost3(), redisProperties.getPort3())
.withSentinelMasterId(redisProperties.getMasterId())
.withAuthentication("", redisProperties.getPassword())
.withDatabase(redisProperties.getDatabase())
.build();
redisURI.getSentinels().forEach(r -> r.setPassword(redisProperties.getPassword()));
return redisURI;
}
@Bean
public RedisClient redisClient(RedisURI redisUri, RedisProperties redisProperties) {
File certFile = new File(redisProperties.getCertPath());
SslOptions sslOptions = SslOptions.builder()
.trustManager(certFile)
.keyManager(certFile, certFile, null)
.build();
ClientOptions clientOptions =
ClientOptions.builder()
.protocolVersion(ProtocolVersion.RESP2)
.sslOptions(sslOptions)
.build();
RedisClient redisClient = RedisClient.create(redisUri);
redisClient.setOptions(clientOptions);
return redisClient;
}
@Bean
public StatefulRedisConnection<String, String> statefulRedisConnection(RedisClient redisClient) {
return redisClient.connect();
}
@Bean
public RedisCommands<String, String> redisCommands(StatefulRedisConnection<String, String> statefulRedisConnection) {
return statefulRedisConnection.sync();
} |
Beta Was this translation helpful? Give feedback.
-
I was in the same situation because I have to use the "redisUri" connection since I use Redis Standalone in some environments and Redis Sentinel in others. @Bean
public LettuceConnectionFactory redisConnectionFactory() {
RedisURI redisUri = RedisURI.create("redis-sentinel://pass@host1:port1,host2:port2,host3:port3/1?sentinelMasterId=mymaster");
// this foreach fixes my code
redisUri.getSentinels().foreach(redisSentinelUri ->
redisSentinelUri.applyAuthentication(redisUri)
);
return new LettuceConnectionFactory(
LettuceConnectionFactory.createRedisConfiguration(redisUri),
LettuceClientConfiguration.builder()
.readFrom(ReadFrom.REPLICA_PREFERED)
.build()
);
} And to be complete, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Help! Can't work with radish sentinel.
im use spring-boot-starter-data-redis:2.6.6
redis server v=6.0.16
Where can i set the password?
Beta Was this translation helpful? Give feedback.
All reactions