Reputation:
Just started to study zookeeper architecture and its communication with the hbase
I have some doubt in leader election of zookeeper cluster
As far as i learned zookeepers will select its master using transaction id but when we freshly connect the zookeeper cluster all zookeeper's transaction id will be zero now how it will select its leader.....
Can any one please explain in detail.....
Thanks in advance
Upvotes: 1
Views: 478
Reputation: 4496
There are several metrics zookeeper will take into consideration while in an election, like epoch
/zxid
/id
, which you can verify from the implementation of FastLeaderElection.totalOrderPredicate
.
To answer your question, if all your zk nodes start at the same time in a freshly cluster, the one with the biggest id (which is specified by you in the file myid
) will be elected as the leader.
Upvotes: 2