从主集群定期的导出最近两个快照之差,然后导入到备集群。
rbd export-diff test_pool/test_image testimage_now
rbd import-diff testimage_now test_pool/test_image
echo "v0.log" >> /mnt/ceph_lihang/v0.log
#create snap v1
rbd snap create test_pool/test_image@v1
echo "v1.log" >> /mnt/ceph_lihang/v1.log
#create snap v2
rbd snap create test_pool/test_image@v2
echo "v2.log" >> /mnt/ceph_lihang/v2.log
#create snap v3
rbd snap create test_pool/test_image@v3
echo "v3.log" >> /mnt/ceph_lihang/v3.log
#create snap v4
rbd snap create test_pool/test_image@v4
echo "v4.log" >> /mnt/ceph_lihang/v4.log
#create snap v5
rbd snap create test_pool/test_image@v5
echo "v5.log" >> /mnt/ceph_lihang/v5.log
#export snap v1
rbd export-diff test_pool/test_image@v1 testimage_v1
#export snap v2
rbd export-diff test_pool/test_image@v2 testimage_v2
#export snap v3
rbd export-diff test_pool/test_image@v3 testimage_v3
#export snap v4
rbd export-diff test_pool/test_image@v4 testimage_v4
#export snap v5
rbd export-diff test_pool/test_image@v5 testimage_v5
#import snap v1
rbd import-diff testimage_v1 test_pool/test_image
#import snap v2
rbd import-diff testimage_v2 test_pool/test_image
#import snap v3
rbd import-diff testimage_v3 test_pool/test_image
#import snap v4
rbd import-diff testimage_v4 test_pool/test_image
#import snap v5
rbd import-diff testimage_v5 test_pool/test_image
echo "v0.log" >> /mnt/ceph_lihang/v0.log
#create snap v1
rbd snap create test_pool/test_image@v1
echo "v1.log" >> /mnt/ceph_lihang/v1.log
#create snap v2
rbd snap create test_pool/test_image@v2
echo "v2.log" >> /mnt/ceph_lihang/v2.log
#create snap v3
rbd snap create test_pool/test_image@v3
echo "v3.log" >> /mnt/ceph_lihang/v3.log
#create snap v4
rbd snap create test_pool/test_image@v4
echo "v4.log" >> /mnt/ceph_lihang/v4.log
#create snap v5
rbd snap create test_pool/test_image@v5
echo "v5.log" >> /mnt/ceph_lihang/v5.log
#首次导出 export v1
rbd export-diff test_pool/test_image@v1 testimage_v1
#export (snap v1 - snap v2)
rbd export-diff test_pool/test_image@v2 --from-snap v1 testimage_v1_v2
#export (snap v2 - snap v3)
rbd export-diff test_pool/test_image@v3 --from-snap v2 testimage_v2_v3
#export (snap v3 - snap v4)
rbd export-diff test_pool/test_image@v4 --from-snap v3 testimage_v3_v4
#export (snap v4 - snap v5)
rbd export-diff test_pool/test_image@v5 --from-snap v4 testimage_v4_v5
#import snap v1
rbd import-diff testimage_v1 test_pool/test_image
#import (snap v1 - snap v2)
rbd import-diff testimage_v1_v2 test_pool/test_image
#import (snap v2 - snap v3)
rbd import-diff testimage_v2_v3 test_pool/test_image
#import (snap v3 - snap v4)
rbd import-diff testimage_v3_v4 test_pool/test_image
#import (snap v4 - snap v5)
rbd import-diff testimage_v4_v5 test_pool/test_image
最终选择方案三定期的备份增量文件,达到增量备份。
1.在主集群创建Image的快照 2.导出主集群Image的全量快照 3.将导出的全量快照文件传输到备集群 4.备集群创建对应的pool/image 5.导入全量快照文件到备集群中 6.完成备份
1.在主集群查找最近的快照文件,并且确认备集群是否存在同名的快照 2.在主集群创建Image的快照 3.导出最近快照文件和刚创建快照文件的差量文件。(导出每次diff,实现增量备份) 4.将导出的差量快照文件传输到备集群 5.导入全量快照文件到备集群中 6.完成备份
- 定期的每天导出增量的数据文件,在做恢复的时候,就从第一个快照导入,然后按顺序导入增量的快照即可。
- 定期做一个快照,导出完整的快照数据,以防中间的增量快照漏了。
- 定期清理快照