/// <summary> /// TBD /// </summary> /// <param name="node">TBD</param> /// <exception cref="InvalidOperationException"> /// This exception is thrown when a non-leader tries to down the specified <paramref name="node"/>. /// </exception> public override void Down(Address node) { if (!_leader) { throw new InvalidOperationException("Must be leader to down node"); } _cluster.LogInfo("Leader is auto-downing unreachable node [{0}]", node); _cluster.Down(node); }
private void down(Address node) { if (!_isLeader) { return; } _cluster.Down(node); }
protected override void OnReceive(object message) { var up = message as ClusterEvent.MemberUp; if (up != null) { var mem = up; Log.Info("Member is Up: {0}", mem.Member); } else if (message is ClusterEvent.UnreachableMember) { var unreachable = (ClusterEvent.UnreachableMember)message; Log.Info("Member detected as unreachable: {0}", unreachable.Member); //멤버와 갑자기 연락 두절이 되었기때문에, 멈버를 제거합니다. Cluster.Down(unreachable.Member.Address); } else if (message is ClusterEvent.MemberRemoved) { var removed = (ClusterEvent.MemberRemoved)message; Log.Info("Member is Removed: {0}", removed.Member); } else if (message is ClusterEvent.IMemberEvent) { //IGNORE } else if (message is AskToken) { OnReceiveDataByAskToken(message as AskToken); //실제 처리할 DataProcess } else if (message is string) { Log.Info(message as string); } else { Unhandled(message); } }
private void HandleStabilityReached() { if (Log.IsInfoEnabled && _unreachable.Any()) { Log.Info("A network partition detected - unreachable nodes: [{0}], remaining: [{1}]", string.Join(", ", _unreachable.Select(m => m.Address)), string.Join(", ", _reachable.Select(m => m.Address))); } var context = new NetworkPartitionContext(_unreachable, _reachable); var nodesToDown = _strategy.Apply(context).ToImmutableArray(); if (nodesToDown.Length > 0) { if (Log.IsInfoEnabled) { Log.Info("A network partition has been detected. {0} decided to down following nodes: [{1}]", _strategy, string.Join(", ", nodesToDown)); } foreach (var member in nodesToDown) { _cluster.Down(member.Address); } } }