etcd
etcd is a key-value store built on the Raft consensus protocol.
Administration
etcd data is stored in /var/lib/etcd
by default.
The etcd
daemon is managed with the etcdctl
client, which is obtainable directly from GitHub as a standalone statically-linked binary or in container form.
The version of the protocol used for communication with the server is specified by the ETCDCTL_API
environment variable; it's easiest to export this in the shell ahead of time. The --cacert
, --cert
and --key
options can also be specified as environment variable.
Snapshotting
Snapshots take a backup of the current state of the data:
etcdctl \
--endpoints https://localhost:2379 \
--cacert /etc/etcd/ca.crt \
--cert /etc/etcd/server.crt \
--key /etc/etcd/server.key \
snapshot save /tmp/backup.db
etcdctl \
--write-out=table \
snapshot status /tmp/backup.db
Restore
Just specify the path:
etcdctl snapshot restore /tmp/backup.db
Managing members
Listing:
$ etcdctl --endpoints http://localhost:2379 \
member list
8211f1d0f64f3269, started, member1, http://10.0.0.1:2380, http://10.0.0.1:2379
91bc3c398fb3c146, started, member2, http://10.0.0.2:2380, http://10.0.0.2:2379
fd422379fda50e48, started, member3, http://10.0.0.3:2380, http://10.0.0.3:2379
Removing failed members:
etcdctl member remove 8211f1d0f64f3269
Adding new members:
etcdctl member add name --peer-urls=http://10.0.0.4:2380
Backlinks