From b78c4d8c7b55e78ed9b2c45036ccd1ac4d41cf15 Mon Sep 17 00:00:00 2001 From: Wenjia Zhang Date: Thu, 13 Jun 2024 05:50:45 +0000 Subject: [PATCH] Update how-to-create-locks.md Signed-off-by: Wenjia Zhang --- .../en/docs/v3.6/tutorials/how-to-create-locks.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/content/en/docs/v3.6/tutorials/how-to-create-locks.md b/content/en/docs/v3.6/tutorials/how-to-create-locks.md index 24ffc0cf6..2232b85ed 100644 --- a/content/en/docs/v3.6/tutorials/how-to-create-locks.md +++ b/content/en/docs/v3.6/tutorials/how-to-create-locks.md @@ -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.