Version v3.6-DRAFT of the documentation is in DRAFT status. For the latest stable documentation, see v3.5.
How to conduct leader election in etcd cluster
Guide to conducting leader election in an etcd cluster
Prerequisites
elect
for leader election:
- The
etcdctl
command is used to conduct leader elections in an etcd cluster. It makes sure that only one client become leader at a time. - Ensure the
ENDPOINTS
variable is set with the addresses of each etcd cluster members. - Set a unique name for the election for different clients (’one’ in the given code below).
- Lastly, set different leaders name for each clients (p1 and p2).
Command format :
etcdctl --endpoints=$ENDPOINTS elect <election-name> <leader-name>
etcdctl --endpoints=$ENDPOINTS elect one p1
# another client with the same election name block
etcdctl --endpoints=$ENDPOINTS elect one p2
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.