Leader election during operation

When the leader server in the cluster is down or unavailable, the entire cluster will not be able to provide services to the outside world, but will enter a new round of leader election. The basic process of leader election during server operation and leader election during startup is Consistent.

(1) Change status. After the leader is suspended, the remaining non-Observer servers will change their server status to LOOKING, and then start the leader election process.

(2) Each server will issue a vote. During operation, the ZXID on each server may be different. At this time, assume that the ZXID of Server1 is 123 and the ZXID of Server3 is 122; in the first round of voting, both Server1 and Server3 will vote for themselves and generate votes (1, 123), (3, 122), and then send their votes to all machines in the cluster. Receive votes from various servers. The process is the same as at startup.

(3) Process voting. The process is the same as at startup. At this time, Server1 will become the leader. 

(4) Statistical voting. The process is the same as at startup.

(5) Change the status of the server. Same process as at startup

 

 

Guess you like

Origin blog.csdn.net/Leon_Jinhai_Sun/article/details/112971539