Glossary · System coordination, integration and orchestration
Leader election
Also known as: master election, primary election
German: Leader-Wahl
In distributed systems, leader election is the process by which a group of nodes chooses one node as coordinator (leader) for a task, and chooses a new one when the leader fails, so that exactly one node acts as leader at a time.
- System integration
In one sentence
Leader election lets a group of nodes choose one coordinator and pick a new one when it fails, so only one node leads at a time.
Example
Three edge nodes run a data collector, but only the elected leader writes to the machine; when it fails, the remaining nodes elect a new leader within seconds.
How it applies
- Engineering: Leader election prevents several nodes from performing the same action, such as writing setpoints or processing the same order. It is typically built on consensus algorithms or on leases (see Lease (distributed systems)) from a coordination service.
- Risks: During network partitions, a poorly designed election can produce two leaders (split brain). Fencing, for example rejecting commands from outdated leaders, protects the targets.
- Documentation: Operations documentation should state which node is currently leader, how to see it, how long a new election takes and what happens to in-flight work.
Leader election vs. active-standby redundancy
Active-standby redundancy often uses a fixed primary and a fixed backup. Leader election is dynamic: any eligible node can become leader, which suits clusters with more than two nodes.