begin to add node backup
This commit is contained in:
parent
f10ce63569
commit
39cb2b0007
19
scripts/node-backup.sh
Executable file
19
scripts/node-backup.sh
Executable 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
|
2
systemd/node-backup.service
Normal file
2
systemd/node-backup.service
Normal file
@ -0,0 +1,2 @@
|
||||
Type=oneshot
|
||||
ExecStart=/scripts/node-backup.sh
|
0
systemd/node-backup.timer
Normal file
0
systemd/node-backup.timer
Normal file
Loading…
Reference in New Issue
Block a user