lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Discovery Service does not support SENTINAL REPLICAS

Open tishun opened this issue 1 year ago • 3 comments

Bug Report

With the introduction of #2144 discovery service connections no longer work as the Discovery service does not support the SENTINEL REPLICAS command

Current Behavior

Connection fails before bing established, because the SentinelTopologyProvider attempts to execute SENTINEL REPLICAS

Stack trace
Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command
	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147)
	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116)
	... 21 common frames omitted

Input Code

Input Code
        RedisURI sentinelUri = RedisURI.Builder
                .sentinel(ENV0_SENTINEL, 8001, MASTER_ID)
                .withAuthentication(SENTINEL_USERNAME, SENTNEL_PASSWORD)
                .build();
        RedisClient client = RedisClient.create();

        StatefulRedisMasterReplicaConnection<String, String> connection = MasterReplica.connect(
                client,
                StringCodec.UTF8,
                sentinelUri);

        connection.setReadFrom(ReadFrom.REPLICA);

        connection.sync().get("key");

        connection.close();
        client.shutdown();

Expected behavior/code

Establish connection successfully.

Environment

  • Lettuce version(s): 6.2.x or later
  • Redis version: any

tishun avatar Jan 16 '25 13:01 tishun

@tishun I tried to set up Redis Sentinel on my local and run with your code, but it worked without issues. Could you please check my code: https://github.com/thachlp/redis-sentinel

thachlp avatar Mar 29 '25 15:03 thachlp

@tishun I tried to set up Redis Sentinel on my local and run with your code, but it worked without issues. Could you please check my code: https://github.com/thachlp/redis-sentinel

Oh, my bad, should have mentioned that the Discovery service is Redis Enterprise feature. You'd need to have one set up to test this. For now let's keep this epic in the backlog until we can see what is the best way to approach it.

tishun avatar Mar 30 '25 14:03 tishun

@tishun thanks for explaining

thachlp avatar Mar 30 '25 14:03 thachlp