ETCD database backup and restore

Source: Internet
Author: User
Tags etcd

1. Backup etcd1.1 manually back up data
etcdctl backup --data-dir /var/lib/etcd/default.etcd --backup-dir 备份目录
1.2 Script backup Data

Use the ETCD command etcdctl for etc Backup, the script is as follows:

#!/bin/bashdate_time=`date +%Y%m%d`etcdctl backup --data-dir /var/lib/etcd/default.etcd --backup-dir /root/etcd71-${date_time}.etcdtar cvzf etcd71-${date_time}.tar.gz etcd71-${date_time}.etcd
1.3 Delete 7 days ago Historical backup
find /root/*.etcd -ctime +7 -exec rm -r {} \;find /root/*.gz -ctime +7 -exec rm -r {} \;
2. Restore etcd2.1 stand-alone operation
etcd --data-dir=/var/lib/etcd/default.etcd --force-new-cluster &
2.2 View ID
etcdctl member list1c4358be138c6d94: name=default peerURLs=https://192.168.61.71:2380 clientURLs=http://localhost:2379 isLeader=true
2.3 Data Synchronization
curl http://127.0.0.1:2379/v2/members/1c4358be138c6d94 -XPUT -H "Content-Type:application/json" -d ‘{"peerURLs":["http://127.0.0.1:2379"]}‘
2.4 End stand-alone operation
pkill -9 etcd
2.5 Restarting the service
systemctl restart etcdsystemctl status etcd

ETCD database backup and restore

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.