Hao Liang's Blog

Embrace the World with Cloud Native and Open-source

Detailed explanation of Raft algorithm

1. Leader election process In the raft protocol, a node is in one of the following three states at any time: leader: master node follower: slave node candidate: candidate master node 1. Election at startup: When a node starts, it is in the follower state. If it does not receive a heartbeat from the leader within a period of time, it switches from follower to candidate and initiates an election. If it receives the majority of votes in the cluster (including its own vote), it will switch to the leader state; if it is found that other nodes have become the leader before itself, it will actively switch to the follower state.