5-node Raft cluster
Crash nodes, partition the network, watch leader election & log replication. The simulator is the algorithm — same paper, same invariants.
Not a game.
This is the Raft consensus algorithm running locally in your browser — same algorithm that runs etcd, CockroachDB, and Consul. The 5 dots are nodes. The lines between them are RPC channels. The traveling dots are messages in flight (cyan = AppendEntries, magenta = RequestVote).
Nothing is faked. Every leader you see won an actual majority vote. Every commit went through actual log replication and a quorum check.
Try this in order:
- 1Wait 3–5 seconds. One node turns cyan — that's the leader.
- 2Click that leader to crash it. A new election fires; a new leader takes over with a higher term.
- 3Hit the
{n1,n2} | {n3,n4,n5}partition. The minority side cannot elect a leader, ever — that's the safety property. - 4Click
No partition. The cluster reconciles to a single leader at the highest term. - 5Type a value into
PROPOSEand hit→. Watch the entry replicate to followers, commit on the majority, then apply to each state machine.
Invariants this proves:
- ✓ At most one leader per term — no split-brain
- ✓ No committed entry is ever lost on a partition heal
- ✓ A node only votes for one candidate per term
- ✓ A leader only commits entries from its current term (§5.4.2)
10 of these invariants are checked in CI via tests/scripts/verify-raft-sim.mjs.
→ Click any node to crash/revive it. The 2-3 partition forces split-brain attempts; heal it and watch the higher-term side absorb the rest.