RedisResponseException: No such master with that name

I have tested the implemention using the development kit setup by ServiceStack, redis-config Git repository which is excellent - thank you. This works perfectly.

When I try and use this on my test environment, which has 1 master, 1 slave, and 3 sentinels I get the following exception:

ServiceStack.Redis.RedisException: No Redis Sentinels were available ---> ServiceStack.Redis.RedisResponseException: No such master with that name
   at ServiceStack.Redis.RedisNativeClient.CreateResponseError(String error)
   at ServiceStack.Redis.RedisNativeClient.ReadDeeplyNestedMultiDataItem()
   at ServiceStack.Redis.RedisNativeClient.ReadDeeplyNestedMultiData()
   at ServiceStack.Redis.RedisNativeClient.SendReceive[T](Byte[][] cmdWithBinaryArgs, Func`1 fn, Action`1 completePipelineFn, Boolean sendWithoutRead)
   at ServiceStack.Redis.RedisNativeClient.SendExpectDeeplyNestedMultiData(Byte[][] cmdWithBinaryArgs)
   at ServiceStack.Redis.RedisNativeClient.SentinelSlaves(String masterName)
   at ServiceStack.Redis.RedisSentinelWorker.GetSlaveHosts(String masterName)
   at ServiceStack.Redis.RedisSentinelWorker.GetSentinelInfo()
   at ServiceStack.Redis.RedisSentinel.GetSentinelInfo()
   at ServiceStack.Redis.RedisSentinel.GetRedisManager()
   at ServiceStack.Redis.RedisSentinel.GetValidSentine...

Which is strange, according to the docs, the client should connect to a sentinel and execute SENTINEL masters which in my case returns:

R:\Redis>redis-cli -h redistest1 -p 26379
redis redistest1:26379> SENTINEL masters
1)  1) "name"
    2) "redistest1"
    3) "ip"
    4) ""
    5) "port"
    6) "6379"

I believe ServiceStack is doing this part. It should then request SENTINEL get-master-addr-by-name redistest1 which returns:

redis redistest1:26379> SENTINEL get-master-addr-by-name redistest1
1) ""
2) "6379"

However according to ServiceStack the sentinel returns No such master with specified name. I cannot enable monitor on the sentinels as they do not support this command too see what is actually being requested. The sentinel log files contain no information. The redis/sentinel VMs are accessable by the host VM (it was previously accessing redistest1 without sentinel support).

Edit: I am not specifying a master name when setting up the RedisManagerPool, as I do not believe this is required.

What could I be missing here? What is the next step to debugging my configuration?

Many thanks,

I’m assuming you’re telling RedisSentinel about what master group it should be looking for?

var sentinel = new RedisSentinel(sentinelHosts, masterName: "redistest1");


In terms of debugging you can enable debug Logging, e.g:

LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true); 

If the command logging is too verbose you can disable logging each command with:

RedisConfig.DisableVerboseLogging = true;

Custom Hooks

The RedisSentinel class also provides a number of hooks you can put a breakpoint on and inspect, e.g:

sentinel.OnFailover = manager => "Redis Managers Failed Over to new hosts".Print();
sentinel.OnWorkerError = ex => "Worker error: {0}".Print(ex);
sentinel.OnSentinelMessageReceived = (channel, msg) => "Received '{0}' on channel '{1}' from Sentinel".Print(channel, msg);

Debug Source Code

Otherwise you can always just clone ServiceStack.Redis and debug the source code directly. Adding a new test in RedisSentinelTests.cs should make it easy to step through and see what the issue is.

Also if it helps the NuGet packages and symbols for each release is published at:

Specifying a masterName on RedisSentinel did resolve the issue.

I don’t know why this is required as I did not do this when running the example with the same code?

Thank you for the extra information about Logging and the Custom Hooks.

The sentinel processes can monitor many different master groups simultaneously, so if you deviate from the default mymaster group you need to specify what the new master group name it should be connecting to.

Understood - many thanks for the clarification and of course the superb library.

1 Like