Skip to content

Commit ab46c51

Browse files
authored
Merge pull request #46778 from robert-cronin/update-etcd-commands
Add clarification on the usage of etcdutl vs etcdctl
2 parents e21094d + 364f5bb commit ab46c51

File tree

1 file changed

+62
-10
lines changed

1 file changed

+62
-10
lines changed

content/en/docs/tasks/administer-cluster/configure-upgrade-etcd.md

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ guide on a cluster with at least two nodes that are not acting as control plane
2020
nodes. If you do not already have a cluster, you can create one by using
2121
[minikube](https://minikube.sigs.k8s.io/docs/tutorials/multi_node/).
2222

23+
### Understanding etcdctl and etcdutl
24+
25+
`etcdctl` and `etcdutl` are command-line tools used to interact with etcd clusters, but they serve different purposes:
26+
27+
- `etcdctl`: This is the primary command-line client for interacting with etcd over a
28+
network. It is used for day-to-day operations such as managing keys and values,
29+
administering the cluster, checking health, and more.
30+
31+
- `etcdutl`: This is an administration utility designed to operate directly on etcd data
32+
files, including migrating data between etcd versions, defragmenting the database,
33+
restoring snapshots, and validating data consistency. For network operations, `etcdctl`
34+
should be used.
35+
36+
For more information on `etcdutl`, you can refer to the [etcd recovery documentation](https://etcd.io/docs/v3.5/op-guide/recovery/).
37+
2338
<!-- steps -->
2439

2540
## Prerequisites
@@ -281,17 +296,54 @@ ETCDCTL_API=3 etcdctl --endpoints $ENDPOINT snapshot save snapshot.db
281296

282297
Verify the snapshot:
283298

284-
```shell
285-
ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshot.db
286-
```
299+
{{< tabs name="etcd_verify_snapshot" >}}
300+
{{% tab name="Use etcdutl" %}}
301+
The below example depicts the usage of the `etcdutl` tool for verifying a snapshot:
287302

288-
```console
289-
+----------+----------+------------+------------+
290-
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
291-
+----------+----------+------------+------------+
292-
| fe01cf57 | 10 | 7 | 2.1 MB |
293-
+----------+----------+------------+------------+
294-
```
303+
```shell
304+
etcdutl --write-out=table snapshot status snapshot.db
305+
```
306+
307+
This should generate an output resembling the example provided below:
308+
309+
```console
310+
+----------+----------+------------+------------+
311+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
312+
+----------+----------+------------+------------+
313+
| fe01cf57 | 10 | 7 | 2.1 MB |
314+
+----------+----------+------------+------------+
315+
```
316+
317+
{{% /tab %}}
318+
{{% tab name="Use etcdctl (Deprecated)" %}}
319+
320+
{{< note >}}
321+
The usage of `etcdctl snapshot status` has been **deprecated** since etcd v3.5.x and is slated for removal from etcd v3.6.
322+
It is recommended to utilize [`etcdutl`](https://github.com/etcd-io/etcd/blob/main/etcdutl/README.md) instead.
323+
{{< /note >}}
324+
325+
The below example depicts the usage of the `etcdctl` tool for verifying a snapshot:
326+
327+
```shell
328+
export ETCDCTL_API=3
329+
etcdctl --write-out=table snapshot status snapshot.db
330+
```
331+
332+
This should generate an output resembling the example provided below:
333+
334+
```console
335+
Deprecated: Use `etcdutl snapshot status` instead.
336+
337+
+----------+----------+------------+------------+
338+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
339+
+----------+----------+------------+------------+
340+
| fe01cf57 | 10 | 7 | 2.1 MB |
341+
+----------+----------+------------+------------+
342+
```
343+
344+
345+
{{% /tab %}}
346+
{{< /tabs >}}
295347

296348
### Volume snapshot
297349

0 commit comments

Comments
 (0)