Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 989 Bytes

how-to-conduct-elections.md

File metadata and controls

29 lines (19 loc) · 989 Bytes
title description weight
How to conduct leader election in etcd cluster
Guide to conducting leader election in an etcd cluster
900

Prerequisites

  • Ensure etcd and etcdctl is installed.
  • Check for active etcd cluster.

elect for leader election:

  1. 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.
  2. Ensure the ENDPOINTS variable is set with the addresses of each etcd cluster members.
  3. Set a unique name for the election for different clients ('one' in the given code below).
  4. 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