In this case, the Leader will be disconnected from ZK cluster and will give
up its leadership. Since its disconnected, ZK cluster will realize that the
Leader is dead!....
When Zk cluster realizes that the Leader is dead (this is because the zk
cluster hasn't heard from the Leader for a certain time.... Configurable via
session timeout parameter), the slaves will be notified of this via watchers
in zookeeper cluster. The slaves will realize that the Leader is gone and
will relect a new Leader and will start working with the new Leader.
Does that answer your question?
You might want to look though the documentation of ZK to understand its use
case and how it solves these kind of issues....
On 4/30/10 2:08 PM, "Lei Gao" <l...@linkedin.com> wrote:
> Thank you all for your answers. It clarifies a lot of my confusion about the
> service guarantees of ZK. I am still struggling with one failure case (I am
> not trying to be the pain in the neck. But I need to have a full
> understanding of what ZK can offer before I make a decision on whether to
> used it in my cluster.)
> Assume the following topology:
> Leader ==== ZK cluster
> \\ //
> \\ //
> \\ //
> If I am asymmetric network failure such that the connection between Leader
> and Slave(s) are broken while all other connections are still alive, would
> my system hang after some point? Because no new leader election will be
> initiated by slaves and the leader can't get the work to slave(s).
> On 4/30/10 1:54 PM, "Ted Dunning" <ted.dunn...@gmail.com> wrote:
>> If one of your user clients can no longer reach one member of the ZK
>> cluster, then it will try to reach another. If it succeeds, then it will
>> continue without any problems as long as the ZK cluster itself is OK.
>> This applies for all the ZK recipes. You will have to be a little bit
>> careful to handle connection loss, but that should get easier soon (and
>> isn't all that difficult anyway).
>> On Fri, Apr 30, 2010 at 1:26 PM, Lei Gao <l...@linkedin.com> wrote:
>>> I am not talking about the leader election within zookeeper cluster. I
>>> I didn't make the discussion context clear. In my case, I run a cluster
>>> uses zookeeper for doing the leader election. Yes, nodes in my cluster are
>>> the clients of zookeeper. Those nodes depend on zookeeper to elect a new
>>> leader and figure out what the current leader is. So if the zookeeper
>>> of it as a stand-alone entity) becomes unavailabe in the way I've described
>>> earlier, how can I handle such situation so my cluster can still function
>>> while a majority of nodes still connect to each other (but not to the