采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("192.168.0.109:6379,192.168.0.109:6390,192.168.0.110:6379,192.168.0.111:6379,192.168.0.111:6380,192.168.0.111:6381")
请问你用的哪个类库,虽然不太清楚.net的sentinel客户端,不过所有sentinel客户端都应该是sentinelSet和masterName作为参数,才可以实现高可用。
谢谢老师的解答。老师忙完双十一了(#^.^#),使用的库为:StackExchange.Redis,我在Github找到了下面的配置: private string ServiceName => TestConfig.Current.SentinelSeviceName; private ConnectionMultiplexer Conn { get; } private IServer Server { get; } public ITestOutputHelper Output { get; } public Sentinel(ITestOutputHelper output) { Output = output; Skip.IfNoConfig(nameof(TestConfig.Config.SentinelServer), TestConfig.Current.SentinelServer); Skip.IfNoConfig(nameof(TestConfig.Config.SentinelSeviceName), TestConfig.Current.SentinelSeviceName); var options = new ConfigurationOptions() { CommandMap = CommandMap.Sentinel, EndPoints = { { TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort } }, AllowAdmin = true, TieBreaker = "", ServiceName = TestConfig.Current.SentinelSeviceName, SyncTimeout = 5000 }; Conn = ConnectionMultiplexer.Connect(options, Console.Out); Thread.Sleep(3000); Assert.True(Conn.IsConnected); Server = Conn.GetServer(TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort); } 我先试试,遇到问题再请教老师
登录后可查看更多问答,登录/注册
Redis课程升级!系统梳理Redis知识体系,掌握redis必备!
1.2k 1
1.2k 2
937 12
2.1k 9
836 6