LinuxCommandLibrary

etcdctl

Interact with etcd key-value store

TLDR

Display the value associated with a specified key

$ etcdctl get [my/key]
copy

Store a key-value pair
$ etcdctl put [my/key] [my_value]
copy

Delete a key-value pair
$ etcdctl del [my/key]
copy

Store a key-value pair, reading the value from a file
$ etcdctl put [my/file] < [path/to/file.txt]
copy

Save a snapshot of the etcd keystore
$ etcdctl snapshot save [path/to/snapshot.db]
copy

Restore a snapshot of an etcd keystore (restart the etcd server afterwards)
$ etcdctl snapshot restore [path/to/snapshot.db]
copy

Add a user
$ etcdctl user add [my_user]
copy

Watch a key for changes
$ etcdctl watch [my/key]
copy

SYNOPSIS

etcdctl [flags] command [command flags] [arguments]

PARAMETERS

--cacert <CA_FILE>
    SSL trust root certificate for verifying the server's certificate.

--cert <CERT_FILE>
    SSL certificate file.

--command-timeout <duration>
    Timeout for each etcd request. (default: 5s)

--dial-timeout <duration>
    Dial timeout for client connections. (default: 2s)

--endpoints <endpoints>
    etcd cluster endpoints.

--hex
    Print byte slices as hex encoded strings.

--insecure-discovery
    Accept insecure gRPC connections.

--insecure-skip-tls-verify
    Skip server certificate verification.

--key <KEY_FILE>
    SSL key file.

--user <user:password>
    Username[:password] for authentication.

--write-out <format>
    Output format (default: simple). Possible values: simple, json, protobuf, grpc-gateway.

--version
    Display the version information.

DESCRIPTION

The etcdctl command is a command-line client used to interact with an etcd cluster.
etcd is a distributed key-value store used for configuration management, service discovery, and coordinating distributed work. etcdctl allows you to perform various operations on the etcd cluster such as reading, writing, and deleting keys, monitoring key changes, managing cluster membership, performing backups, and configuring cluster settings.
It supports multiple etcd versions via versioning and provides features such as authentication (TLS/SSL), endpoints configuration, and output formatting (e.g., JSON, YAML). etcdctl is an essential tool for developers and operators managing applications that rely on etcd for distributed coordination.

CAVEATS

Using insecure options like `--insecure-discovery` and `--insecure-skip-tls-verify` can compromise the security of your etcd cluster. Avoid using these in production environments.

SUBCOMMANDS

etcdctl provides numerous subcommands for various tasks, including: get, put, del, watch, member list, snapshot save, and many others. Consult the etcdctl documentation or use `etcdctl help` for a full list and their usage. Each subcommand accepts its own set of command-specific flags and arguments.

<B>ETCD</B> API VERSION

etcdctl auto-negotiates the etcd API version. The environment variable `ETCDCTL_API=3` is recommended to be set to use the v3 API.

HISTORY

etcdctl was developed alongside the etcd project as its command-line interface.
It has evolved over time with changes to the etcd API. Earlier versions (v2) had different command structures and functionalities than later versions (v3). The tool is central to manage and operate etcd clusters for application development.

SEE ALSO

systemctl(1), docker(1), kubectl(1)

Copied to clipboard