Reputation: 2413
There are other questions similar to this but I wanted to boil this down to the bare bones.
I am running a .NET
application (C#
) and am trying to connect to and monitor a group of redis
servers running sentinel (3x sentinel monitoring 1 master and 2 slaves). They are on linux
boxes.
I can use ServiceStack.Redis
to write/read to the the master of the three if I hard-code that server. What I want to do is monitor sentinel to see which is master to make that read/write dynamic.
Here is my code:
var sentinelHosts = new[]{ "server01Name", "server02Name", "server03Name" };
var sentinel = new RedisSentinel(sentinelHosts, masterName: "mymaster");;
IRedisClientsManager redisManager = sentinel.Start();
This throws an exception which says No Redis Sentinels were available
.
I'm sure I am missing something very simple but I can't seem to get traction on this.
I am running redis
version 4.0.1 and ServiceStack.Redis
version 4.5.14.0.
Thanks!
Upvotes: 1
Views: 312
Reputation: 2413
Yes, it was very simple. The masterName
MUST match the master name in your sentinel setup server side.
Upvotes: 1