Skip to content

Commit

Permalink
Update how-to-create-locks.md
Browse files Browse the repository at this point in the history
Part of KubeCon EU 24 doc sprint

#794
  • Loading branch information
wenjiaswe committed Mar 19, 2024
1 parent 168b0ce commit b7d4b98
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions content/en/docs/v3.6/tutorials/how-to-create-locks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ description: Guide to creating distributed locks in etcd
weight: 800
---

LOCK acquires a distributed mutex with a given name. Once the lock is acquired, it will be held until etcdctl is terminated.

## Prerequisites

* Install [`etcd` and `etcdctl`](https://etcd.io/docs/v3.6/install/)

## Creating a lock

`lock` for distributed lock:

![08_etcdctl_lock_2016050501](https://storage.googleapis.com/etcd/demo/08_etcdctl_lock_2016050501.gif)

```shell
etcdctl --endpoints=$ENDPOINTS lock mutex1

# another client with the same name blocks
etcdctl --endpoints=$ENDPOINTS lock mutex1
```

### Options
- endpoints - defines a comma-delimited list of machine addresses in the cluster.
- ttl - time out in seconds of lock session.

0 comments on commit b7d4b98

Please sign in to comment.