Leader election
Leader election is a distributed coordination process that selects one eligible participant to act as leader or coordinator.
Kafka for Architects
Leader election is the process of selecting a controller or partition leader to coordinate operations and accept leadership responsibilities.
- How it is used
- Maintains metadata coordination after a Kafka leader controller fails.
- How deep it goes
- Explains KRaft election triggers, voting rules, majority selection, and post-election synchronization; does not walk through implementation code.
- Examples
- Uses a failed KRaft leader controller and a three-controller failure-tolerance calculation.
- What you can do after
- Evaluate/understand controller failover and quorum sizing for Kafka high-availability planning.
Apache Kafka in Action
Leader election is the process of selecting a node to act as leader among eligible nodes in a distributed system.
- How it is used
- Restores partition availability after a leader broker fails by promoting a replica and directing clients to it.
- How deep it goes
- Traces failure, metadata refresh, and leader epochs with commands, but does not specify a candidate-selection algorithm.
- Examples
- Uses a three-replica partition listing, a stopped and restarted broker, checkpoint contents, and a preferred-election command.
- What you can do after
- Diagnose/debug with it by checking partition leaders and leader epochs after broker failure.
Kubernetes in Action, Second Edition
Leader election is a coordination mechanism that selects one instance as active leader while other instances remain ready to take over after failure.
- How it is used
- Provides distributed applications with infrastructure-managed selection of an active instance and failover readiness.
- How deep it goes
- Defines active and standby roles and failure takeover, but does not explain the election algorithm or implementation steps.
- Examples
- Uses the scenario of one active application instance with idle instances ready to take over after failure.
- What you can do after
- Evaluate how Kubernetes can provide leader selection without embedding infrastructure coordination in application business logic.
Read how Kubernetes in Action, Second Edition explains leader election →
Think Distributed Systems
A Raft protocol that elects a leader for a term and starts a new election when the current leader is suspected to have failed.
- How it is used
- Coordinates Raft nodes so one current-term leader can manage replicated-log progress despite suspected leader failure.
- How deep it goes
- Explains terms, node states, timers, voting outcomes, demotion, log freshness, and fencing, without detailing message-format or implementation internals.
- Examples
- Uses election timers, RequestVote requests, quorum and split-vote outcomes, term fencing, and follower-candidate-leader state diagrams.
- What you can do after
- Evaluate/understand how Raft selects a leader, retries split elections, rejects stale leadership, and protects committed state.
Read how Think Distributed Systems explains leader election →
Related concepts
- controllerused by · A Kafka controller is a server role that manages cluster metadata and coordinates partition, replica, and leader state.
- ZooKeeperused by · Apache ZooKeeper is a distributed coordination service that provides shared configuration, naming, synchronization, metadata management, and leader-election primitives.
- Raftimplemented by · Raft is a distributed consensus algorithm that uses leader election and replicated logs to coordinate nodes and maintain consistent replicated state despite failures.
- quorumuses · A quorum is the minimum number or proportion of distributed participants whose responses or agreement are sufficient for an operation or decision.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



