Open holidaycottages opened 9 years ago
Sorry I didn't see this sooner. Yes, that is possible. You should take a look at RedisSessionProvider.Config.RedisConnectionConfig.GetSERedisServerConfig
. The KeyValuePair<string, ConfigurationOptions>
that is the return type is the same ConfigurationOptions
that is defined in StackExchange.Redis. Since that object has logic in it for specifying multiple server addresses, you should be fine defining something like this:
// this method gets run by RedisSessionProvider every time it reads or writes to redis
RedisConnectionConfig.GetSERedisServerConfig = (HttpContextBase context) =>
{
// specify any additional sentinel logic here if you want
return new KeyValuePair<string, ConfigurationOptions>("DefaultSessConfig", ConfigurationOptions.Parse(MyHost0 + "," + MyHost1));
};
Also, you may want to take replication lag into account (if any exists).
Hello, I want to use a redis setup that consists of a master and some slaves, also I want to configure in my infrastructure redis sentinel, so HA can be achieved.
I believe in stackexchange.redis that can accept multiple redis instances and it will work out what is the master and the slave.
If we use your session state provider can we do the same thing?
So instead of specifying one redis instance, we pass in multiple and it then will use the master for writing to and if the master fails and then is rolled over to one of the slaves then the application using the session state wont try and connect or write to the original master as that would potentially be down or a read only slave.
Hope I am making some sense there! Your advice would be appreciated.