ETCD backup !ssues

Before doing the restore etcdtl is it required to run the command in the below order

1. systemctl stop etcd
2. ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/opt/ca.crt --cert=/opt/KUIN00601/etcd-client.crt --key=/opt/etcd-client.key snapshot restore /srv/data/etcd-snapshot-previous.db
3. systemctl start etcd

Please reply

1 Like

HOW TO RESTORE ETCD

  1. Reset etcd by removing all existing etcd data:
    sudo systemctl stop etcd
    sudo rm -rf /var/lib/etcd

  2. Restore the etcd Data from the Backup
    sudo ETCDCTL_API=3 etcdctl snapshot restore /tmp/etcd_backup.db --initial-cluster etcd-restore=https://10.0.1.101:2379 --initial-advertise-peer-urls https://10.0.1.101:2379 --name etcd-restore --data-dir /var/lib/etcd

  3. Set ownership on the new data directory:
    sudo chown -R etcd:etcd /var/lib/etcd

  4. Start and Enable etcd:

                    sudo systemctl start etcd
                    sudo systemctl enable etcd
    
  5. Check the status
    sudo systemctl status etcd

  6. Verify the restored data is present by looking up the value for the key cluster.name
    again:
    ETCDCTL_API=3 etcdctl get cluster.name
    –endpoints=https://10.0.1.101:2379
    –cacert=/home/cloud_user/etcd-certs/etcd-ca.pem
    –cert=/home/cloud_user/etcd-certs/etcd-server.crt
    –key=/home/cloud_user/etcd-certs/etcd-server.key