资料查找
https://www.cnblogs.com/tdws/p/5836122.html
https://www.cnblogs.com/lori/p/5794454.html
private static readonly ConnectionMultiplexer _sentinel;
static ISubscriber sub;
static ISubscriber sentinelsub;
ConfigurationOptions sentineloption = new ConfigurationOptions();
ConfigurationOptions option = new ConfigurationOptions();
option.EndPoints.Add("10.55.8.110", 6379);
option.EndPoints.Add("10.55.8.111", 6379);
option.Password = "abc12345!";
ConnectionMultiplexer _redis = ConnectionMultiplexer.Connect(option);
IDatabase _db = _redis.GetDatabase();
sentineloption.TieBreaker = "";
sentineloption.EndPoints.Add("10.55.8.110", 26379);
sentineloption.EndPoints.Add("10.55.8.111", 26379);
sentineloption.AllowAdmin = true;
sentineloption.CommandMap = CommandMap.Sentinel;
ConnectionMultiplexer _sentinel = ConnectionMultiplexer.Connect(sentineloption);
option.CommandMap = CommandMap.Sentinel;
sentinelsub = _sentinel.GetSubscriber();
SubSentinel()
public void SubSentinel()
{
sentinelsub.Subscribe("+switch-master", (channel, message) =>
{
lblShow.Text = (string)message;
//Console.WriteLine((string)message);
});
}
原文地址:https://www.cnblogs.com/jayblog/p/8282743.html