首页 > 其他分享 >Etcd备份脚本

Etcd备份脚本

时间:2023-03-12 09:34:10浏览次数:35  
标签:脚本 -% Etcd -- 备份 etcd pki DIR

点击查看代码
[root@master0 share]# cat etcdbak.sh 
#!/bin/bash -v

#Etcd time scripts backup auther
DATE=`date +%Y-%m-%d_%H-%M-%S`
NODE_IPS="192.168.201.60"
CACERT="/etc/kubernetes/pki/etcd/ca.crt"
CERT="/etc/kubernetes/pki/etcd/server.crt"
KEY="/etc/kubernetes/pki/etcd/server.key"
BACKUP_DIR="/data/backups/etcd-bak"
ETCDCTL_API=3 /usr/bin/etcdctl snapshot save ${BACKUP_DIR}/etcd-snapshot-${DATE}.db \
  --cacert=${CACERT} \
  --cert=${CERT} \
  --key=${KEY} \
  --endpoints="${NODE_IPS}:2379"

find $BACKUP_DIR/ -type f -mtime +20 -exec rm -f {} \;

标签:脚本,-%,Etcd,--,备份,etcd,pki,DIR
From: https://www.cnblogs.com/yidadasre/p/17207613.html

相关文章