1
0

begin to add node backup

This commit is contained in:
michael 2024-02-03 01:24:47 +13:00
parent f10ce63569
commit 39cb2b0007
3 changed files with 21 additions and 0 deletions

19
scripts/node-backup.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
mkdir -p /backup/etcd
mkdir -p /backup/ceph
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
# Backup etcd
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /backup/etcd/snapshot_$TIMESTAMP.db
# Backup ceph
tar -czf /backup/ceph/ceph_$TIMESTAMP.tar.gz /var/lib/rook
# Replicate backup to hv00
rsync -az /backup/etcd/snapshot_$TIMESTAMP.db backup:/mnt/backup/etcd/snapshot_$TIMESTAMP.db
rsync -az /backup/ceph/ceph_$TIMESTAMP.tar.gz backup:/mnt/backup/ceph/ceph_$TIMESTAMP.tar.gz

View File

@ -0,0 +1,2 @@
Type=oneshot
ExecStart=/scripts/node-backup.sh

View File