StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.85k stars 1.5k forks source link

Is it possible to have different passwords for each endpoint in StackExchange.Redis #2639

Open urehman-sopheon opened 5 months ago

urehman-sopheon commented 5 months ago

I am trying to setup endpoints for master and slave. As per the Basics documentation https://stackexchange.github.io/StackExchange.Redis/Configuration.html you can connect to multiple Redis servers, and StackExchange.Redis will automatically determine the master/slave setup.

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("server1:6379,server2:6379");

Is it possible to have different passwords for master and slave setup?

Here is my code for Master setup, i can add more endpoints to setup slave but not sure if Redis allows different passwords for Master and Slave.

  var configurationOptions = new ConfigurationOptions
  {
   EndPoints = { { cachedserver.Host, cachedserver.Port }, },
   Password = cachedserver.Password,
   SslProtocols = System.Security.Authentication.SslProtocols.Tls12,
  };
NickCraver commented 5 months ago

This isn't possible today (the config is shared for all endpoints) - if you really wanted this, I'd recommend setting up 2 different multiplexers for such a case. Generally, people having a primary/replica is for HA, so they're very intentionally interchangeable and with matched setup.