CEPH快速搭建五(ceph的image管理)

Image 对应于 LVM 的 Logical Volume,它将被条带化为 N 个子数据块,每个数据块将会被以对象(object)形式保存在 RADOS 对象存储中的简单块设备


在pool2下创建一个大小为100M的myimage的RBD Image(默认情况下,它被条带化为 4MB 大小的 25 个对象 )
备注:pool2不能创建快照,否则将不能被正常创建images
[ceph@ceph-admin cluster]$ ceph osd pool create pool2 64
pool 'pool2' created
[ceph@ceph-admin cluster]$ rbd create pool2/myimage --size 100

创建一个大小为100M,条带化大小为8M的对象
[ceph@ceph-admin cluster]$ rbd create pool2/myimage2 --size 100 --order 23

查看image
[ceph@ceph-admin cluster]$ rbd info pool2/myimage
rbd image 'myimage':
size 102400 kB in 25 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.10ec6b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
[ceph@ceph-admin cluster]$ rbd info pool2/myimage2
rbd image 'myimage2':
size 102400 kB in 13 objects
order 23 (8192 kB objects)
block_name_prefix: rbd_data.10f56b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:


删除image
[ceph@ceph-admin cluster]$ rbd rm pool2/myimage4

 

image的对象挂载

直接挂载会报错
[ceph@ceph-admin cluster]$ sudo rbd map pool2/myimage

rbd: sysfs write failed
RBD image feature set mismatch. You can disable features unsupported by the kernel with "rbd feature disable".
In some cases useful info is found in syslog - try "dmesg | tail" or so.
rbd: map failed: (6) No such device or address

备注: 提示image特性不支持,不需要删除部分特性
通过
[ceph@ceph-admin cluster]$ rbd info pool2/myimage2|grep features
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
了解到,系统只支持layering特性,因此需要去除其他特性,去除的方式有很多种
第一:
[ceph@ceph-admin cluster]$ rbd feature disable pool2/myimage exclusive-lock object-map fast-diff deep-flatten
第二:
创建rbd镜像时就指明需要的特性,如:
[ceph@ceph-admin cluster]$ $ rbd create --size 4096 pool2/myimage3 --image-feature layering
第三:
如果还想一劳永逸,那么就在执行创建rbd镜像命令的服务器中,修改Ceph配置文件/etc/ceph/ceph.conf,在global section下,增加
rbd_default_features = 1
再创建rdb镜像。
[ceph@ceph-admin cluster]$ $ rbd create --size 4096 pool2/myimage4



再次尝试加载为一个设备
[ceph@ceph-admin cluster]$ sudo rbd map pool2/myimage
/dev/rbd0


查看本地加载设备
[ceph@ceph-admin cluster]$ rbd showmapped
id pool image snap device
0 pool2 myimage - /dev/rbd0

挂载
[ceph@ceph-admin cluster]$ sudo mkfs.xfs /dev/rbd0
[ceph@ceph-admin cluster]$ sudo mount /dev/rbd0 /mnt/test


取消映射
[root@ceph-node3 ~]# rbd unmap pool2/myimage

书写文档不易,如果你觉得我写得可以打个赏呗

https://www.fageka.com/store/item/s/id/Yx6TZ1m0747.html

CEPH快速搭建六(cephfs文件存储管理)

https://blog.csdn.net/xx496146653/article/details/89248204

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值