Hi Guido,

I think in your case you are shutting down before the node has communicated 
to the leader that it wants to leave. I wait to get the MemberExited 
message before shutting down the node. Maybe I should wait for the 
MemberRemoved? Either way the ultimate aim is to not have the unreachable 
logic kick in and have to wait x seconds (I use 10 seconds) for the node to 
be auto downed by the leader. And the reason why I don't want to wait is 
according to the docs the leader wouldn't be able to add nodes whilst any 
node in the cluster is considered unreachable, which is a problem if I'm 
doing a rolling restart of all the nodes.

Regards,
Ben

On Thursday, March 17, 2016 at 4:51:30 PM UTC-4, Guido Medina wrote:
>
> As for cluster.leave(cluster.selfAddress) my micro-services use the 
> following to leave:
>
>     Runtime.getRuntime().addShutdownHook(new Thread() {
>       @Override
>       public void run() {
>         final Cluster cluster = Cluster.get(system);
>         cluster.leave(cluster.selfAddress());
>         system.terminate();
>         Configurator.shutdown((LoggerContext) LogManager.getContext());
>       }
>     });
>
> But honestly I have never seen that work, the other nodes just report it 
> as unreachable until it times out and it is completely removed,
> maybe the shutdown happens so fast that it is useless in my case.
>
> HTH,
>
> Guido.
>
> On Thursday, March 17, 2016 at 8:33:29 PM UTC, Guido Medina wrote:
>>
>> Hi Benjamin,
>>
>> I also rely on cluster events and AFAIK you can expect (and trust) 
>> *MemberUp* and *MemberRemoved*, these IMHO are the only two consistent 
>> states you can trust.
>> In other words, I register some actors only when their nodes reach 
>> *MemberUp* and unregister only when their nodes reach *MemberRemoved*
>> Any other state in between I would treat them as information only.
>>
>> So far I haven't got any issue with my mini-shard implementation relying 
>> on these only 2 statuses, the draw back is that it will only have to wait 
>> for a longer time to react.
>>
>> HTH,
>>
>> Guido.
>>
>> On Thursday, March 17, 2016 at 6:07:48 PM UTC, Benjamin Black wrote:
>>>
>>> Hello,
>>>
>>> I'm adding logic to our service so that when a node is being restarted 
>>> it gracefully leaves the cluster using cluster.leave(cluster
>>> .selfAddress). In the cluster specification doc it states:
>>>
>>> If a node is unreachable then gossip convergence is not possible and 
>>> therefore any leader actions are also not possible (for instance, 
>>> allowing a node to become a part of the cluster). To be able to move 
>>> forward the state of theunreachable nodes must be changed. It must 
>>> become reachable again or marked as down
>>>
>>> Is this totally true? If a node is unreachable and is the 
>>> leaving/exiting/removed state will this stop the leader from adding a new 
>>> node? I ask because I have an actor that subscribes to cluster events and I 
>>> can see a node is being added whilst another node is considered unreachable 
>>> and in the exiting status:
>>>
>>> 14:02:46.843 INFO  Exited member Member(address = akka.tcp://
>>> geyser@172.16.120.160:7000, status = Exiting)
>>> 14:02:51.842 INFO  Unreachable member Member(address = akka.tcp://
>>> geyser@172.16.120.160:7000, status = Exiting)
>>> 14:02:53.843 INFO  Removing member Member(address = akka.tcp://
>>> geyser@172.16.120.160:7000, status = Removed)
>>> 14:02:57.843 INFO  Exited member Member(address = akka.tcp://
>>> geyser@172.16.119.46:7000, status = Exiting)
>>> 14:03:02.760 INFO  Unreachable member Member(address = akka.tcp://
>>> geyser@172.16.119.46:7000, status = Exiting)
>>> 14:03:04.843 INFO  Adding member Member(address = akka.tcp://
>>> geyser@172.16.120.160:7000, status = Up)
>>>
>>> Thanks,
>>> Ben
>>>
>>>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to