Distributed Systems
Leader election
Explain leader election in Raft, where terms and majority votes allow at most one leader per term, and why a paused old leader still needs a check before it writes.
What you will be able to do
- Explain how terms and majority votes limit a group to one leader per term.
- Decide where a leader must check its term or token before a side effect.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Distributed Systems
- Lamport clocksIntermediate · 4 min
Explain Lamport's happened-before relation and the logical clock rule that places causes before effects across machines, without relying on synchronized wall-clock time…
- Vector clocksIntermediate · 5 min
Explain vector clocks, how an entry-by-entry comparison shows whether two versions are ancestors or concurrent, and why concurrent versions must be merged rather than…
- Raft logsIntermediate · 5 min
Explain Raft log entries, how a majority commit makes an entry survive a leader change, and why an uncommitted entry can be overwritten, so clients must retry safely.
- Quorum reads and writesAdvanced · 4 min
Explain quorum reads and writes, how R plus W greater than N makes a read overlap the latest acknowledged write, and why that guarantee covers one key only.
- Split brain preventionAdvanced · 5 min
Explain how split brain happens when two nodes each take over during a partition, and how a majority rule, a witness and fencing prevent two active owners.
- Fencing tokensAdvanced · 4 min
Explain fencing tokens, where a resource rejects writes carrying an older token, and why a lock alone cannot stop a paused holder from writing after its lease has…