Automate the /var/lib/ceph backup during recovery phase
To keep strong consistency for Ceph when Ceph nodes are collocated with controllers, it is necessary to take a backup of the /var/lib/ceph directory just before doing a recovery, restore the ReaR backup and then extract the /var/lib/ceph backup over the (old) ceph data that is outdated. With this simple action, the information lost is almost none. This change creates two new scripts that are executed by ReaR during restore that do exactly what is needed, eliminating the need for doing it by hand. Change-Id: Ib7c699b737980c5495cce2cf42f5847fda0f72f5
This commit is contained in:
parent
9494142444
commit
ee470d0ccc
|
@ -112,3 +112,8 @@ tripleo_backup_and_restore_ceph_mon_role: "ceph_mon"
|
|||
|
||||
# The cephadm path
|
||||
tripleo_backup_and_restore_cephadm_path: "/usr/sbin/cephadm"
|
||||
|
||||
# Configure /var/lib/ceph automatic backuping and restoration during a recovery
|
||||
tripleo_backup_and_restore_ceph_device: /dev/vda2
|
||||
tripleo_backup_and_restore_ceph_device_format: xfs
|
||||
|
||||
|
|
|
@ -141,3 +141,32 @@
|
|||
when: sftp_backup
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Program a script that will trigger during restore backuping /var/lib/ceph if it exists just before restore
|
||||
blockinfile:
|
||||
path: /usr/share/rear/setup/default/011_backup_ceph.sh
|
||||
block: |
|
||||
set -e
|
||||
echo "Taking a fresh ceph data backup if this controller has co-located cephs"
|
||||
mount -t {{ tripleo_backup_and_restore_ceph_device_format }} {{ tripleo_backup_and_restore_ceph_device }} /mnt/local
|
||||
cd /mnt/local
|
||||
[ -d "var/lib/ceph" ] && tar cvfz /tmp/ceph.tar.gz var/lib/ceph --xattrs --xattrs-include='*.*' --acls
|
||||
cd /
|
||||
umount {{ tripleo_backup_and_restore_ceph_device }}
|
||||
create: yes
|
||||
tags:
|
||||
- bar_setup_rear
|
||||
|
||||
- name: Program a script that will trigger during retoration to restore /var/lib/ceph backup after a full recovery
|
||||
blockinfile:
|
||||
path: /usr/share/rear/wrapup/default/501_restore_ceph.sh
|
||||
block: |
|
||||
set -e
|
||||
echo "Restoring ceph backup if it exists"
|
||||
if [ -f "/tmp/ceph.tar.gz" ]; then
|
||||
rm -rf /mnt/local/var/lib/ceph/*
|
||||
tar xvC /mnt/local -f /tmp/ceph.tar.gz var/lib/ceph --xattrs --xattrs-include='*.*'
|
||||
fi
|
||||
create: yes
|
||||
tags:
|
||||
- bar_setup_rear
|
Loading…
Reference in New Issue