ZAB protocol (Zookeeper atomic Broadcast)

1. Brief introduction:

The ZAB protocol is a classic implementation of the Paxos algorithm

2. Two modes of ZAB protocol:

Crash recovery:

1. Each server has a vote (myid, zxid), vote for itself

2. Collect votes from all servers

3. Compare voting (logic: compare zxid first, select the one with the largest zxid, and then compare myid)

4. Change the server state (crash recovery -> message broadcast or crash recovery -> data synchronization)

Message broadcast:

1. After the leader receives the request, it generates a globally unique 64-bit self-incrementing zxid proposal

2. Send the proposal to all followers

3. After all followers receive the proposal, they first write the proposal to the hard disk, and immediately reply the leader with an ACK

4. When the leader receives a legal number of ACKs, the leader will send a commit command to all followers

5.Follower executes the commit command

To be continued ...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325788313&siteId=291194637
Recommended