internal SentinelInfo GetSentinelInfo() { var masterHost = this.GetMasterHostInternal(this._sentinel.MasterName); if (masterHost == null) { throw new RedisException("Redis Sentinel is reporting no master is available"); } var sentinelInfo = new SentinelInfo(this._sentinel.MasterName, new[] { masterHost }, this.GetSlaveHosts(this._sentinel.MasterName)); return(sentinelInfo); }
private IRedisClientManager CreateRedisManager(SentinelInfo sentinelInfo) { var masters = this.ConfigureHosts(sentinelInfo.RedisMasters); var slaves = this.ConfigureHosts(sentinelInfo.RedisSlaves); var redisManager = this.RedisManagerFactory(masters, slaves); var hasRedisResolver = (IHasRedisResolver)redisManager; hasRedisResolver.RedisResolver = new RedisSentinelResolver(this, masters, slaves); if (redisManager is IRedisFailover canFailover && this.OnFailover != null) { canFailover.OnFailover.Add(this.OnFailover); } return(redisManager); }