真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

etcd集群備份恢復(fù)

一、備份
此備份方式是借助 etcd的snapshot功能做備份,需要時(shí)可以把etcd集群回滾到具體備份的時(shí)間點(diǎn),此備份是基于etcd api 3版本的備份,如果數(shù)據(jù)是用api 2版本寫(xiě)入的,則api 2版本寫(xiě)入的數(shù)據(jù)無(wú)法恢復(fù)
1、備份

公司主營(yíng)業(yè)務(wù):成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站開(kāi)發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開(kāi)放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來(lái)的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來(lái)驚喜。創(chuàng)新互聯(lián)推出義烏免費(fèi)做網(wǎng)站回饋大家。

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem snapshot save /chj/backup/etcd3/snapshot.db
2、備份腳本

#!/bin/bash
DATA=`date +%y%m%d`
BACUPDIR=/chj/backup/etcd
ENDPOINTS='https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379'
timestamp=`date +%Y%m%d%H%M%S`
if [ ! -d "$BACUPDIR" ]; then
    echo "making dir $BACUPDIR"
    mkdir -p $BACUPDIR
fi
ETCDCTL_API=3 etcdctl --endpoints=$ENDPOINTS  --cert=/etc/etcd/ssl/etcd.pem  --key=/etc/etcd/ssl/etcd-key.pem  --cacert=/etc/etcd/ssl/ca.pem  snapshot save $BACUPDIR/snapshot_$timestamp.db
find $BACUPDIR -name *.db  -mtime +5 -exec rm -rf {} \;

二、恢復(fù)
1、停止所有節(jié)點(diǎn)的服務(wù)

systemctl stop etcd
2、把當(dāng)前數(shù)據(jù)目錄備份

mv /var/lib/etcd /var/lib/etcd_bak_20190523
3、確認(rèn)需要回滾的快照文件,分布還原到集群的每個(gè)節(jié)點(diǎn)上

#還原192.168.9.87節(jié)點(diǎn)
ETCDCTL_API=3 etcdctl --name=k8stest-master-1.chj.cloud --endpoints="https://192.168.9.87:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem --initial-cluster-token=etcd-cluster-0 --initial-advertise-peer-urls=https://192.168.9.87:2380 --initial-cluster=k8stest-master-1.chj.cloud=https://192.168.9.87:2380,k8stest-master-2.chj.cloud=https://192.168.9.88:2380,k8stest-master-3.chj.cloud=https://192.168.9.89:2380 --data-dir=/var/lib/etcd snapshot restore /chj/backup/etcd3/snapshot.db
#還原192.168.9.88節(jié)點(diǎn)
ETCDCTL_API=3 etcdctl --name=k8stest-master-2.chj.cloud --endpoints="https://192.168.9.88:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem --initial-cluster-token=etcd-cluster-0 --initial-advertise-peer-urls=https://192.168.9.88:2380 --initial-cluster=k8stest-master-1.chj.cloud=https://192.168.9.87:2380,k8stest-master-2.chj.cloud=https://192.168.9.88:2380,k8stest-master-3.chj.cloud=https://192.168.9.89:2380 --data-dir=/var/lib/etcd snapshot restore /chj/backup/etcd3/snapshot.db
#還原192.168.9.89節(jié)點(diǎn)
ETCDCTL_API=3 etcdctl --name=k8stest-master-3.chj.cloud --endpoints="https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem --initial-cluster-token=etcd-cluster-0 --initial-advertise-peer-urls=https://192.168.9.89:2380 --initial-cluster=k8stest-master-1.chj.cloud=https://192.168.9.87:2380,k8stest-master-2.chj.cloud=https://192.168.9.88:2380,k8stest-master-3.chj.cloud=https://192.168.9.89:2380 --data-dir=/var/lib/etcd snapshot restore /chj/backup/etcd3/snapshot.db

三、常用命令
使用API 3寫(xiě)入數(shù)據(jù)

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem put /chj/3 api3
使用API 3讀數(shù)據(jù)

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem get /chj/3
使用API 3 查看所有key

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem get / --prefix --keys-only
使用API 3 刪除所有key

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem del "" --prefix

查看集群成員

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem member list --write-out=table
查看集群健康狀態(tài)

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem endpoint health

查看節(jié)點(diǎn)狀態(tài)

ETCDCTL_API=3 etcdctl --endpoints="https://192.168.9.87:2379,https://192.168.9.88:2379,https://192.168.9.89:2379" --cert=/etc/etcd/ssl/etcd.pem --key=/etc/etcd/ssl/etcd-key.pem --cacert=/etc/etcd/ssl/ca.pem endpoint status --write-out=table


分享名稱:etcd集群備份恢復(fù)
文章URL:http://weahome.cn/article/gijgcc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部