Coordinate with leaders and consensus
Learn what consensus solves and why leader leases need care.
- Describe consensus, leader election, and split-brain risk at a high level.
Consensus protocols let nodes agree on an ordered sequence of decisions despite some failures, under specific assumptions such as a majority being able to communicate. Systems often elect a leader to simplify writes, but election alone is not enough: an old leader may still believe it is in charge after a partition. Terms, quorum checks, and fencing tokens help reject stale leaders. Consensus does not make a system immune to arbitrary failures or network delay.
1nodes = 5
2majority = nodes // 2 + 1
3reachable = 3
4print(f"quorum: {reachable >= majority}")quorum: True
This counts a majority for illustration. Raft and Paxos are families of consensus protocols with detailed safety and liveness rules; production systems must implement the whole protocol rather than rely on a majority check alone.
Key takeaways
Consensus depends on explicit assumptions about failures and communication.
Leader election needs protection against stale leaders.
A majority check alone is not a consensus algorithm.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…