Leader selection is not random, but based on the last transaction acknowledged. Peers vote for the one with highest zxid (server ids break ties) and leave election once they hear the same vote from a quorum. If everything goes well, a quorum supports the new leader and system is able to make progress. 

-Flavio

On Jul 24, 2011, at 10:02 PM, Chiku Singh wrote:

Suppose I have 5 node configuration in the Zookeeper {1,2,3,4,5} Zookeeper
says that a leader is elected when a majority of nodes vote for any given
node then, the node having majority of nodes is selected as the leader.
Zookeeper benchmark says that a leader election typically takes 200 ms.

My question is how is the convergence achieved?

Do all nodes start voting for the node 1 as the leader or they start
selecting the leader randomly? If the appointment of leader is totally
random then how does it ensure convergence or such fast rates of leader
election?

Thanks for the answer! Help appreciated!

flavio
junqueira
 
research scientist
 
[email protected]
direct +34 93-183-8828
 
avinguda diagonal 177, 8th floor, barcelona, 08018, es
phone (408) 349 3300    fax (408) 349 3301


Reply via email to