Skip to main content

A distributed, reliable key-value store for the most critical data of a distributed system.

# To start a single-node etcd cluster:
etcd

# To start a single-node etcd cluster, listening for client requests on a custom url:
etcd --advertise-client-urls <http://127.0.0.1:1234> --listen-client-urls <http://127.0.0.1:1234>

# To start a single-node etcd cluster with a custom name:
etcd --name <my_etcd_cluster>

# To start a single-node etcd cluster with extensive metrics available at http://localhost:2379/debug/pprof/:
etcd --enable-pprof --metrics extensive

# ---

#
# etcdctl command
#
# CLI interface for interacting with etcd, a highly-available key-value pair store.
# Etcd stores data in hierarchically organized directories, as in a standard filesystem.
# More information: <https://etcd.io/docs/latest/dev-guide/interacting_v3/>.
#

# To display the value associated with a specified key:
etcdctl get <my/key>

# To store a key-value pair:
etcdctl put <my/key> <my_value>

# To delete a key-value pair:
etcdctl del <my/key>

# To store a key-value pair, reading the value from a file:
etcdctl put <my/file> < <path/to/file.txt>

# To save a snapshot of the etcd keystore:
etcdctl snapshot save <path/to/snapshot.db>

# To restore a snapshot of an etcd keystore (restart the etcd server afterwards):
etcdctl snapshot restore <path/to/snapshot.db>

# To add a user:
etcdctl user add <my_user>

# To watch a key for changes:
etcdctl watch <my/key>