etcd 备份操作---马哥教育

etcd安装:

mkdir -pv etcd-download-test

tar -zxvf etcd-v3.4.4-linux-amd64.tar.gz   -C  etcd-download-test/

编辑修改系统环境变量 /etc/profile

export ETCD_HOME=/tmp/etcd-download-test/etcd-v3.4.4-linux-amd64

export PATH=$PATH:$JAVA_HOME/bin:$ETCD_HOME/

source  /etc/profile

备份ETCD数据库

ETCDCTL_API=3 etcdctl --cert /etc/kubernetes/pki/etcd/peer.crt --key /etc/kubernetes/pki/etcd/peer.key --cacert /etc/kubernetes/pki/etcd/ca.crt --endpoints https://127.0.0.1:2379 snapshot save /data/backup/etcd-snapshot.db
Snapshot saved at /data/backup/etcd-snapshot.db

 查看etcd 成员信息

 ETCDCTL_API=3 etcdctl   --cert /etc/kubernetes/pki/etcd/peer.crt  --key /etc/kubernetes/pki/etcd/peer.key   --cacert /etc/kubernetes/pki/etcd/ca.crt --endpoints https://127.0.0.1:2379  member list

etcd 恢复

ETCDCTL_API=3 etcdctl   --endpoints="https://127.0.0.1:2379"  --cert /etc/kubernetes/pki/etcd/peer.crt    --key /etc/kubernetes/pki/etcd/peer.key    --cacert /etc/kubernetes/pki/etcd/ca.crt   snapshot restore   /data/backup/etcd-snapshot.db   --data-dir=/var/lib/etcd

你可能感兴趣的:(etcd,linux,java,kubernetes,数据库)