You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Redis Sentinel: Command cannot be issued to a slave: ROLE #2876
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
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.
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).
Activity
NickCraver commentedon Apr 29, 2025
What version of StackExchange.Redis are you using here? Based on terminology, we'd assume it's quite old - does this repro on latest?
qmosselm commentedon Feb 16, 2026
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.
mgravell commentedon May 22, 2026
I suspect this will be indirectly fixed by #3088
mgravell commentedon Jul 22, 2026
Addressed in StackExchange.Redis 2.13.17 (#3088): the sentinel primary-verification path now wraps
server.Role()in try/catch with a!server.IsReplicafallback, 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).