2

We going to use ServiceStack.RedisClient, but I was not able figure out how to define a password for sentinels and masters.

I've tried pwd@ipv4:port but no result.

Our code is:

        var sentinelHosts = new[] { "node1:26379", "node2:26379", "node3:26379" };
        var sentinel = new RedisSentinel(sentinelHosts, "mymaster");


        var manager = sentinel.Start();            


        while (true)
        {
            using (var client = manager.GetClient())
            {
                try
                {
                    Console.WriteLine(client.IncrementValue("MyTestKey"));
                }
                catch (RedisException ex)
                {

                    Console.WriteLine($"Error {ex.Message}");
                }                    
            }

            Thread.Sleep(1000);
        }
Dmitriy Sosunov
  • 1,075
  • 3
  • 10
  • 25

1 Answers1

2

You can specify to use passwords for connecting to masters / slaves with an Custom Redis Connection String, e.g:

sentinel.HostFilter = host => "pwd@{0}".Fmt(host);
mythz
  • 141,670
  • 29
  • 246
  • 390