I am trying to spin up a ETCD node in docker and restore a backup obtained from the Kubernetes Cluster node.
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --user=root:'root' snapshot save snapshot.db
I have obtained the snapshot and have it downloaded locally. How could i restore onto a already spinned up etcd node?
The following command was used to spin up the container.I have mounted a data volume.
docker run -d --restart always \
-p 2379:2379 \
-p 2380:2380 \
--volume=etcd-volume:/etcd-data \
--name etcd gcr.io/etcd-development/etcd:latest \
/usr/local/bin/etcd \
--data-dir=/etcd-data --name etcd \
--initial-advertise-peer-urls http://127.0.0.1:2380 --listen-peer-urls
http://0.0.0.0:2380 \
--advertise-client-urls http://127.0.0.1:2379 --listen-client-urls http://0.0.0.0:2379 \
--initial-cluster etcd=http://127.0.0.1:2380
Then I tried to restore it using the following.
ETCDCTL_API=3 etcdctl snapshot restore snapshot.db \
--name m1 \
--initial-cluster m1=http://127.0.0.1:2379 \
--initial-cluster-token etcd-cluster \
--initial-advertise-peer-urls http://127.0.0.1:2379 \
--data-dir /var/lib/docker/volumes/etcd-volume
Both the ETCD cluster and docker are on two different VMs. I tried to execute the above command from the local machine as etcdctl tool has to be installed in docker to execute that command. The restoration has not happened. I just need the keys to be copied onto the new. Any suggestion on how I could do it?