大佬教程收集整理的这篇文章主要介绍了(5)ceph RBD快照,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
[[email protected] alertscripts]# rbd showmapped id pool namespace image snap device 0 rbd remote_rbd1 - /dev/rbd0
(1)rbd已经mount在mnt目录
[[email protected] alertscripts]# df -h Filesystem Size Used Avail Use% Mounted on /dev/rbd0 150G 9.8G 141G 7% /mnt
(2)在/mnt下创建2个测试文件
[[email protected] mnt]# ls ceph-file test test1
(3)服务器端做快照
语法:
rbd snap create<pool-name>/<image-name> @<snap-name
[[email protected] ~]# rbd snap create rbd/[email protected] [[email protected] ~]# rbd snap ls rbd/remote_rbd1 SNAPID NAME SIZE PROTECTED timestAMP snap1 150 GiB Wed Aug 28 15:33:35 2019
[[email protected] mnt]# ls ceph-file test test1 [[email protected] mnt]# rm -fr *
(5)客户端umount 挂载,取消map rbd 映射
[[email protected] /]# umount /mnt/ [[email protected] /]# rbd unmap remote_rbd1
注释:如果不执行上面的卸载命令和取消映射就会出现如下报错
[[email protected] /]# rbd snap rollBACk rbd/[email protected] Rolling BACk to snapshot: 0% complete...Failed. rbd: rollBACk Failed: (30) Read-only file system
(6)通过快照进行回滚,注意快照回滚,之前的数据会被覆盖
语法:rbd snap rollBACk pool-name>/< image-name> @<snap-name
[[email protected] /]# rbd snap rollBACk rbd/[email protected] Rolling BACk to snapshot: 100% complete...done.
(7)重新挂在检查,原来的文件恢复
[[email protected] /]# rbd map remote_rbd1 /dev/rbd0 [[email protected] /]# mount /dev/rbd0 /mnt/ [[email protected] /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 46G 12G 34G 27% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 113M 7.7G 2% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda1 1014M 180M 835M 18% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 /dev/rbd0 150G 33M 150G 1% /mnt [[email protected] /]# cd /mnt/ [[email protected] mnt]# ls test test1
(8)当不再需要某个快照时,可以使用如下命令删除指定的快照 删除快照不会删除 Ceph RBD 镜像巾当前的数据:
[[email protected] /]# rbd snap rm rbd/[email protected] Removing snap: 100% complete...done.
以上是大佬教程为你收集整理的(5)ceph RBD快照全部内容,希望文章能够帮你解决(5)ceph RBD快照所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。