System Design
6. Distributed Systems FundamentalsAnimated
Raft Algorithm
An understandable consensus algorithm.
The idea
Raft has leader election and log replication. Entries commit once a majority has them.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- leader
- candidate
- follower
- crashed
Five servers start as followers. Each waits for a heartbeat from a leader; if none arrives before a random timeout, it will stand for election.
1/10
Raft guarantees at most one leader per term and never loses committed entries.
Step by step
- 1Elect a leader
- 2Leader appends entries
- 3Replicate to followers
- 4Commit on majority
Where it is used
etcd, Consul, many databases.
Watch out for
A slow leader slows everyone.