RedisSentinel
Assembly: ServiceStack.Redis.dll
View Source
public class RedisSentinel : IRedisSentinel, IDisposable
Properties
MasterName
View Source
public string MasterName { get; }
SentinelHosts
View Source
public List<string> SentinelHosts { get; }
RedisManagerFactory
Change to use a different IRedisClientsManager
View Source
public Func<string[], string[], IRedisClientsManager> RedisManagerFactory { get; set; }
HostFilter
Configure the Redis Connection String to use for a Redis Instance Host
View Source
public Func<string, string> HostFilter { get; set; }
SentinelHostFilter
Configure the Redis Connection String to use for a Redis Sentinel Host
View Source
public Func<string, string> SentinelHostFilter { get; set; }
RedisManager
The configured Redis Client Manager this Sentinel managers
View Source
public IRedisClientsManager RedisManager { get; set; }
OnFailover
Fired when Sentinel fails over the Redis Client Manager to a new master
View Source
public Action<IRedisClientsManager> OnFailover { get; set; }
OnWorkerError
Fired when the Redis Sentinel Worker connection fails
View Source
public Action<Exception> OnWorkerError { get; set; }
OnSentinelMessageReceived
Fired when the Sentinel worker receives a message from the Sentinel Subscription
View Source
public Action<string, string> OnSentinelMessageReceived { get; set; }
IpAddressMap
Map the internal IP's returned by Sentinels to its external IP
View Source
public Dictionary<string, string> IpAddressMap { get; set; }
ScanForOtherSentinels
Whether to routinely scan for other sentinel hosts (default true)
View Source
public bool ScanForOtherSentinels { get; set; }
RefreshSentinelHostsAfter
What interval to scan for other sentinel hosts (default 10 mins)
View Source
public TimeSpan RefreshSentinelHostsAfter { get; set; }
WaitBetweenFailedHosts
How long to wait after failing before connecting to next redis instance (default 250ms)
View Source
public TimeSpan WaitBetweenFailedHosts { get; set; }
MaxWaitBetweenFailedHosts
How long to retry connecting to hosts before throwing (default 60 secs)
View Source
public TimeSpan MaxWaitBetweenFailedHosts { get; set; }
WaitBeforeForcingMasterFailover
How long to wait after consecutive failed connection attempts to master before forcing a Sentinel to failover the current master (default 60 secs)
View Source
public TimeSpan WaitBeforeForcingMasterFailover { get; set; }
SentinelWorkerConnectTimeoutMs
The Max Connection time for Sentinel Worker (default 250ms)
View Source
public int SentinelWorkerConnectTimeoutMs { get; set; }
SentinelWorkerReceiveTimeoutMs
The Max TCP Socket Receive time for Sentinel Worker (default 250ms)
View Source
public int SentinelWorkerReceiveTimeoutMs { get; set; }
SentinelWorkerSendTimeoutMs
The Max TCP Socket Send time for Sentinel Worker (default 250ms)
View Source
public int SentinelWorkerSendTimeoutMs { get; set; }
ResetWhenSubjectivelyDown
Reset client connections when Sentinel reports redis instance is subjectively down (default true)
View Source
public bool ResetWhenSubjectivelyDown { get; set; }
ResetWhenObjectivelyDown
Reset client connections when Sentinel reports redis instance is objectively down (default true)
View Source
public bool ResetWhenObjectivelyDown { get; set; }
Fields
Log
View Source
protected static readonly ILog Log
DefaultMasterName
View Source
public static string DefaultMasterName
DefaultAddress
View Source
public static string DefaultAddress
Methods
Start()
Initialize Sentinel Subscription and Configure Redis ClientsManager
View Source
public IRedisClientsManager Start()
Returns
ServiceStack.Redis.IRedisClientsManager
GetActiveSentinelHosts(IEnumerable<String>)
View Source
public List<string> GetActiveSentinelHosts(IEnumerable<string> sentinelHosts)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | sentinelHosts |
RefreshActiveSentinels()
View Source
public void RefreshActiveSentinels()
ResetClients()
View Source
public SentinelInfo ResetClients()
Returns
SentinelInfo
GetRedisManager()
View Source
public IRedisClientsManager GetRedisManager()
Returns
ServiceStack.Redis.IRedisClientsManager
GetMaster()
View Source
public RedisEndpoint GetMaster()
Returns
ServiceStack.Redis.RedisEndpoint
GetSlaves()
View Source
public List<RedisEndpoint> GetSlaves()
Returns
System.Collections.Generic.List<ServiceStack.Redis.RedisEndpoint>
ForceMasterFailover()
View Source
public void ForceMasterFailover()
GetSentinelInfo()
View Source
public SentinelInfo GetSentinelInfo()
Returns
SentinelInfo
Dispose()
View Source
public void Dispose()
Implements
- ServiceStack.Redis.IRedisSentinel
System.IDisposable