Skip to content

Commit

Permalink
Merge pull request #893 from Shubhdeep02/main
Browse files Browse the repository at this point in the history
Update how-to-conduct-elections.md
  • Loading branch information
jmhbnz authored Sep 10, 2024
2 parents 85e26b6 + 36fb227 commit b75e963
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
19 changes: 16 additions & 3 deletions content/en/docs/v3.5/tutorials/how-to-conduct-elections.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ description: Guide to conducting leader election in an etcd cluster
weight: 900
---

## Prerequisites

- Ensure [`etcd`](https://etcd.io/docs/v3.5/install/) and [`etcdctl`](https://etcd.io/docs/v3.5/install/) is installed.
- Check for active etcd cluster.

`elect` for leader election:

![09_etcdctl_elect_2016050501](https://storage.googleapis.com/etcd/demo/09_etcdctl_elect_2016050501.gif)
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>`



```shell
etcdctl --endpoints=$ENDPOINTS elect one p1

# another client with the same name blocks
# another client with the same election name block
etcdctl --endpoints=$ENDPOINTS elect one p2
```
19 changes: 16 additions & 3 deletions content/en/docs/v3.6/tutorials/how-to-conduct-elections.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ description: Guide to conducting leader election in an etcd cluster
weight: 900
---

## Prerequisites

- Ensure [`etcd`](https://etcd.io/docs/v3.5/install/) and [`etcdctl`](https://etcd.io/docs/v3.5/install/) is installed.
- Check for active etcd cluster.

`elect` for leader election:

![09_etcdctl_elect_2016050501](https://storage.googleapis.com/etcd/demo/09_etcdctl_elect_2016050501.gif)
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>`



```shell
etcdctl --endpoints=$ENDPOINTS elect one p1

# another client with the same name blocks
# another client with the same election name block
etcdctl --endpoints=$ENDPOINTS elect one p2
```

0 comments on commit b75e963

Please sign in to comment.