etcd is a key-value store built on the Raft consensus protocol.
etcd data is stored in
/var/lib/etcd by default.
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
--key options can also be specified as environment variable.
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
Just specify the path:
etcdctl snapshot restore /tmp/backup.db
$ 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