Raft (algorithm): Difference between revisions

Content deleted Content added
Line 18:
A leader election is started by a ''candidate'' server. A server becomes a candidate if it receives no communication by the leader over a period called the ''election timeout'', so it assumes there is no acting leader anymore. It starts the election by increasing the term counter, voting for itself as new leader, and sending a message to all other servers requesting their vote. A server will vote only once per term, on a first-come-first-served basis. If a candidate receives a message from another server with a term number at least as large as the candidate's current term, then the candidate's election is defeated and the candidate changes into a follower and recognizes the leader as legitimate. If a candidate receives a majority of votes, then it becomes the new leader. If neither happens, e.g., because of a split vote, then a new term starts, and a new election begins.<ref name="paper" />
 
Raft uses a randomized election timeout to ensure that split votesvote problemproblems are resolved quickly. This should reduce the chance of a split vote because servers won't become candidates at the same time: a single server will timeouttime out, win the election, then become leader and sendssend heartbeat messages to other servers before any of the followers can become candidates.<ref name="paper" />
 
==== Log Replication ====