typesafehub/constructr-zookeeper

Zookeeper nodes should be ephemeral

amarouni opened this issue · 1 comments

The znodes created by Akka cluster members are not ephemeral which sometimes leads to the following odd situation :

  • Start a new application with a single Akka cluster node using default constructr-zookeeper configuration (max 2 seed nodes)
  • The Akka cluster node adds itself to the zookeeper nodes list and everything works as expected
  • The list in zookeeper contains the node's actor address (with its current IP address)

Now when the Akka cluster node is restarted, and gets a new IP address, it goes through the usual states and finds its old node address in the nodes list (with the old IP address)

  • It tries to use it to join the cluster, but since the IP address is unreachable the node times out and kills the ActorSystem bringing with it the whole application.

If the node created by the Akka cluster node was ephemeral, it would have been cleaned out by zookeeper when the session expired (node went down). So upon restart it would have found no existing nodes and would have registered itself successfully.

Is there any reason why these nodes are not ephemeral ?

Addressed by #31.