Fabulous Feb Offer: Flat 70% Off + 20-days Extra Lab + 10% Addl. Off on All Courses | Use Coupon Code FAFB | Expires inEnroll Now
If you have three nodes A, B, C with A as Leader. And A dies. Will someone become leader?
Either B or C will become the leader.
If you have three nodes A, B, C with C being the leader. And A and B die. Will C remain Leader?
C will step down. No one will be the Leader because majority is not available.
As we discussed that if 50% or less machines are available, there will be no leader and hence the zookeeper will be readonly. Don't you think zookeeper is wasting so many resources?
The question is why does zookeeper need majority for election?
Say, we have an ensemble spread over two data sources. Three machines A B C in one data center 1 and other three D E F in another data center 2. Say, A is the leader of the ensemble.
And say,The network between data centres got disconnected while the internal network of each of the centers is still intact.
If we did not need majority for electing Leader, what will happen?
Each data center will have their own leader and there will be two independent nodes accepting modifications from the users. This would lead to irreconcilable changes and hence inconsitency. This is why we need majority for election in paxos algorithm.
Taking you to the next exercise in seconds...