Etcd搭建备份及还原

  1. Download etcd.tar.gz
  2. 编写etcd的supervisor启动脚本
etcd1
[root@VM_7_centos opt]# cat /etc/supervisord/conf.d/etcd.conf
[program:etcd]
directory=/opt/etcd/etcd-data
command=/usr/local/bin/etcd
  -name ip-xx-xx-xx-7
  --data-dir /opt/etcd/etcd-data
  -initial-advertise-peer-urls http://xx.xx.xx.7:2380
  -listen-peer-urls http://xx.xx.xx.7:2380
  -listen-client-urls http://xx.xx.xx.7:2379,http://127.0.0.1:2379
  -advertise-client-urls http://xx.xx.xx.7:2379
  -initial-cluster-token etcd-cluster-wpys
  -initial-cluster ip-xx-xx-xx-7=http://xx.xx.xx.7:2380,ip-xx-xx-xx-9=http://xx.xx.xx.9:2380
stdout_logfile=/opt/supervisor/log/etcd.log
user=root
redirect_stderr=true
etcd2
[root@VM_9_centos opt]# cat /etc/supervisord/conf.d/etcd.conf
[program:etcd]
directory=/opt/etcd/etcd-data
command=/usr/local/bin/etcd
  -name ip-xx-xx-xx-9
  --data-dir /opt/etcd/etcd-data
  -initial-advertise-peer-urls http://xx.xx.xx.9:2380
  -listen-peer-urls http://xx.xx.xx.9:2380
  -listen-client-urls http://xx.xx.xx.9:2379,http://127.0.0.1:2379
  -advertise-client-urls http://xx.xx.xx.9:2379
  -initial-cluster-token etcd-cluster-wpys
  -initial-cluster ip-xx-xx-xx-7=http://xx.xx.xx.7:2380,ip-xx-xx-xx-9=http://xx.xx.xx.9:2380
stdout_logfile=/opt/supervisor/log/etcd.log
user=root
redirect_stderr=true
  1. 备份
# etcdctl backup --data-dir=/opt/etcd/etcd-data --backup-dir=/tmp/etcd-backup-`date +%y%m%d%H`
  1. 还原
停止etcd,将备份数据拷贝到data-dir下,启动配置需加上--force-new-cluster参数,启动etcd
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容