Skip to content

Redis Sentinel: Command cannot be issued to a slave: ROLE #2876

Closed

Description

@dave-yotta

Hey we've set up redis sentinel but connecting with stackexchange.redis getting a ROLE command sent to a slave inside GetSentinelMasterConnection.

I'm sure this is something we've messed up, it's been tricky to get set up - any chance of help? <3

ERROR Hangfire.Pro.Redis.RedisStorage [(null)] - Couldn't connect to Redis server(s) 'redis-sentinel-0.redis-sentinel-svc.gnigats.svc.cluster.local:26379,redis-sentinel-1.redis-sentinel-svc.gnigats.svc.cluster.local:26379,redis-sentinel-2.redis-sentinel-svc.gnigats.svc.cluster.local:26379', will reconnect in 00:00:30
StackExchange.Redis.RedisCommandException: Command cannot be issued to a slave: ROLE
   at StackExchange.Redis.ConnectionMultiplexer.TryPushMessageToBridge[T](Message message, ResultProcessor`1 processor, ResultBox`1 resultBox, ServerEndPoint& server) in C:\projects\stackexchange-redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1934
   at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 2196
   at StackExchange.Redis.RedisServer.Role(CommandFlags flags) in C:\projects\stackexchange-redis\StackExchange.Redis\StackExchange\Redis\RedisServer.cs:line 326
   at StackExchange.Redis.ConnectionMultiplexer.GetSentinelMasterConnection(ConfigurationOptions config, Action`1 log) in C:\projects\stackexchange-redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.Sentinel.cs:line 210
   at Hangfire.Pro.Redis.RedisStorage.CreateMultiplexer(EventWaitHandle reconnectEvent)
   at Hangfire.Pro.Redis.RedisStorage.ConnectLoop() in C:\projects\hangfire-pro-redis\src\Hangfire.Pro.Redis\RedisStorage.cs:line 508

Activity

  1. NickCraver commented on Apr 29, 2025

    @NickCraver
    Collaborator

    What version of StackExchange.Redis are you using here? Based on terminology, we'd assume it's quite old - does this repro on latest?

  2. qmosselm commented on Feb 16, 2026

    @qmosselm

    Hi @dave-yotta, I got the same issue with Hangfire.Pro.Redis.
    Were you able to find a solution ? It seems they are using the 1.2.7 build binaries of StackExchange.Redis in the last version of Hangfire.Pro.Redis.

  3. mgravell commented on May 22, 2026

    @mgravell
    Collaborator

    I suspect this will be indirectly fixed by #3088

  4. mgravell commented on Jul 22, 2026

    @mgravell
    Collaborator

    Addressed in StackExchange.Redis 2.13.17 (#3088): the sentinel primary-verification path now wraps server.Role() in try/catch with a !server.IsReplica fallback, so 'Command cannot be issued to a slave: ROLE' can no longer propagate from there. Closing as completed.

    If you still hit this on a current build, please comment and we'll reopen (stale replica-state may still cause a retry delay).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions