curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McKenzie <>
Subject Re: Regarding leadership status
Date Tue, 27 Jan 2015 11:04:24 GMT
hey Ricardo,
That's an interesting problem.

If a node is disconnected from ZK it will report that it did not have
leadership, regardless of whether its ephemeral node on ZK has been removed
or not.

If a node is not connected to ZK then I guess it could persist messages
until it is reconnected and then process them afterwards. The issue being
that it may no longer be leader in which case the messages would not be
processed by any node. Not sure if it's possible / practical, but I guess
the node could re-broadcast all of the persisted messages to all nodes (or
just the current leader) once it reconnected to ZK.


On Tue, Jan 27, 2015 at 8:20 PM, Ricardo Ferreira <>

> Hello all,
> I'm using Zookeeper (through Curator) for leadership election on an
> application I'm currently developing.
> Some operations can only be written by one of the members of the cluster,
> so I'm using a node's leadership
> status to this effect.
> For example, let's say a message arrives to all nodes but only one should
> do something about it. What I do
> is to check if the node is leader (through
> LeaderSelector#hasLeadership()), and if it is then it does whatever
> it needs to do with the message. If it's not, it simply ignores it.
> My question is this: How can I be sure a node *really is* the leader?
> What if the leader node is actually down but
> this hasn't been detected by Zookeeper yet? Then the non-leader nodes will
> ignore the message and it will
> never be processed.
> How is this usually dealt with?
> Regards

View raw message