public ResetMasters ( IEnumerable |
||
hosts | IEnumerable |
|
Результат | void |
public void FailoverTo(params string[] readWriteHosts) { Interlocked.Increment(ref RedisState.TotalFailovers); lock (clients) { for (var i = 0; i < clients.Length; i++) { var redis = clients[i]; if (redis != null) { RedisState.DeactivateClient(redis); } clients[i] = null; } RedisResolver.ResetMasters(readWriteHosts); } if (this.OnFailover != null) { foreach (var callback in OnFailover) { try { callback(this); } catch (Exception ex) { Log.Error("Error firing OnFailover callback(): ", ex); } } } }
public void FailoverTo(IEnumerable <string> readWriteHosts, IEnumerable <string> readOnlyHosts) { Interlocked.Increment(ref RedisState.TotalFailovers); var masters = readWriteHosts.ToList(); var replicas = readOnlyHosts.ToList(); Log.Info($"FailoverTo: {string.Join(",", masters)} : {string.Join(",", replicas)} Total: {RedisState.TotalFailovers}"); lock (readClients) { for (var i = 0; i < readClients.Length; i++) { var redis = readClients[i]; if (redis != null) { RedisState.DeactivateClient(redis); } readClients[i] = null; } RedisResolver.ResetSlaves(replicas); } lock (writeClients) { for (var i = 0; i < writeClients.Length; i++) { var redis = writeClients[i]; if (redis != null) { RedisState.DeactivateClient(redis); } writeClients[i] = null; } RedisResolver.ResetMasters(masters); } if (this.OnFailover != null) { foreach (var callback in OnFailover) { try { callback(this); } catch (Exception ex) { Log.Error("Error firing OnFailover callback(): ", ex); } } } }