Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to connect to Sentinel cluster using Resp3 protocol #2591

Closed
Alexander-Leontiev opened this issue Nov 8, 2023 · 2 comments · Fixed by #2601
Closed

Failed to connect to Sentinel cluster using Resp3 protocol #2591

Alexander-Leontiev opened this issue Nov 8, 2023 · 2 comments · Fixed by #2601

Comments

@Alexander-Leontiev
Copy link

Hi!

StackExchange.Redis version 2.7.4
Redis server version 7.0.4

My connection string looks like the following: "redis1:26379, redis2:26379, redis3:26379, serviceName=mymaster, abortConnect=false". I connect like this: ConnectionMultiplexer.Connect(connectionString, logger).
It works like a charm. But when i'm trying to activate new Resp3 protocol adding ", protocol=resp3" to the connection string things are going wrong. I see "StackExchange.Redis.RedisCommandException: This operation has been disabled in the command-map and cannot be used: HELLO" errors in my logs along with messages like "StackExchange.Redis.RedisConnectionException: UnableToConnect on redis1:26379/Interactive, Initializing/NotStarted, last: HELLO, ...".

Having investigated source code i found a couple of interesting places:

private ConnectionMultiplexer(ConfigurationOptions configuration, ServerType? serverType = null, EndPointCollection? endpoints = null) {
...
var map = CommandMap = configuration.GetCommandMap(serverType);
...
}

internal CommandMap GetCommandMap(ServerType? serverType) => serverType switch
        {
            ServerType.Sentinel => CommandMap.Sentinel,
            _ => CommandMap,
        };

public static CommandMap Sentinel { get; } = Create(new HashSet<string> {
            "auth", "ping", "info", "role", "sentinel", "subscribe", "shutdown", "psubscribe", "unsubscribe", "punsubscribe" }, true);

Looks like when the lib detects connection type as Sentinel, it overrides CommandMap with the value, which doesn't contain HELLO command. And i didn't manage to force HELLO availability any way. However according to https://redis.io/docs/management/sentinel/#sentinel-commands Sentinel supports HELLO.

Is it a bug in StackExchange.Redis or should i add some configuration / change the way of connection?

@Alexander-Leontiev
Copy link
Author

@mgravell hi! Sorry for bothering, maybe you are already in progress of research on this issue. However I'd like to get some feedback, even if it will be preliminary and uncertain. Thank you!

@NickCraver
Copy link
Collaborator

Fixing this in #2601 :)

NickCraver added a commit that referenced this issue Nov 23, 2023
This allows connections through Sentinel via RESP3 by adding `HELLO` to the command map.

Fixes #2591.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants