Unit content
Raft consensus
Raft is a leader-based consensus protocol for maintaining a replicated log among nodes that may crash and recover.
Time is divided into numbered terms. A node can be a follower, candidate or leader. If followers stop hearing from a leader, an election can begin for a higher term.
The leader appends client commands to its log and sends those entries to followers. An entry becomes committed only after the protocol has enough replicated evidence that future leaders cannot legitimately discard it.
Raft's election restrictions favor candidates whose logs are sufficiently up to date, preventing a newly elected leader from replacing already committed history with an older log.
Followers repair conflicting uncommitted suffixes by matching the leader's log before accepting later entries.
Raft therefore combines epochs, quorum voting and log replication to preserve one committed command history while allowing leadership to change after failures.