Same log, same code, same state
Servers agree on one ordered log of commands. Each feeds it to the same deterministic code, so replicas match without ever comparing state.
2f+1
members to survive f crashes
Every decision needs a majority, 3 of 5. Any two majorities share a server, so someone in the next knows what the last decided.
Is a fourth node safer?
Bad: Four nodes
Quorum 3, still survives one failure. A 2–2 split leaves neither side a majority.
Good: Five nodes
Quorum 3, survives two: one in maintenance plus one crash.
The leader dies. Whose timer fires first?
Each follower waits a random timeout, 150–300 ms in the paper. The first to fire starts term 2, asks for votes, and leads with 3 of 5.
Two servers think they lead. Only one can commit.
Raft promises at most one leader per term, not one at a time. Old S1 can’t reach 3 of 5, so its write never commits.
Who runs the scheduler?
Bad: Lowest IP wins
Free, but nodes with different views pick different leaders.
Good: Campaign on an etcd lease
Lowest key revision leads. If it dies, its lease expires; the next takes over.
The old leader froze for 20 seconds; a new one took over. It wakes mid-write. What stops it?
The catch
Not the lease. Send the term as a fencing token; receivers reject anything lower.
Remember
One leader per term, commit on a majority: majorities overlap, so nothing committed is lost. Use etcd; fence the leader’s writes.