这篇文章主要为大家展示了“ceph中如何定位文件位置”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“ceph中如何定位文件位置”这篇文章吧。
利用rados put上传并利用map查看文件
[root@osd2 software]# md5sum epel-release-6-8.noarch.rpm 2cd0ae668a585a14e07c2ea4f264d79b epel-release-6-8.noarch.rpm [root@osd2 software]# rados put -p myrbd epel.rpm ./epel-release-6-8.noarch.rpm [root@osd2 software]# ceph osd map myrbd epel.rpm osdmap e88 pool 'myrbd' (4) object 'epel.rpm' -> pg 4.e9ddf5be (4.be) -> up ([4,2], p4) acting ([4,2], p4)
查看所在位置并验证:
[root@osd2 software]# ceph osd tree # id weight type name up/down reweight -1 10.92 root default -2 3.64 host mon0 0 1.82 osd.0 up 1 1 1.82 osd.1 up 1 -3 3.64 host osd1 2 1.82 osd.2 up 1 3 1.82 osd.3 up 1 -4 3.64 host osd2 4 1.82 osd.4 up 1 5 1.82 osd.5 up 1 [root@osd2 software]# cd /cephmp1/current/4.be_head/ [root@osd2 4.be_head]# ls epel.rpm__head_E9DDF5BE__4 [root@osd2 4.be_head]# md5sum epel.rpm__head_E9DDF5BE__4 2cd0ae668a585a14e07c2ea4f264d79b epel.rpm__head_E9DDF5BE__4 [root@osd2 4.be_head]# ll -h total 20K -rw-r--r--. 1 root root 15K Nov 4 17:59 epel.rpm__head_E9DDF5BE__4
利用rbd input上传后进行验证:
[root@osd2 software]# touch hello.txt [root@osd2 software]# echo "hello world" >> hello.txt [root@osd2 software]# rbd import ./hello.txt myrbd/hello.txt Importing image: 100% complete...done. [root@osd2 software]# rbd info myrbd/hello.txt rbd image 'hello.txt': size 12 bytes in 1 objects order 22 (4096 kB objects) block_name_prefix: rb.0.1365.6b8b4567 format: 1 [root@osd2 software]# rados ls -p myrbd rbd_data.13446b8b4567.00000000000000ba rbd_directory rbd_data.13446b8b4567.000000000000007d rbd_data.13446b8b4567.000000000000007c rbd_data.13446b8b4567.000000000000005d rbd_data.13446b8b4567.000000000000007e rbd_data.13446b8b4567.00000000000000ff rb.0.1365.6b8b4567.000000000000 hello.txt.rbd rbd_data.13446b8b4567.00000000000000d9 rbd_data.13446b8b4567.00000000000000f8 rbd_data.13446b8b4567.000000000000009b rbd_data.13446b8b4567.0000000000000001 rbd_header.13446b8b4567 epel.rpm rbd_data.13446b8b4567.000000000000001f rbd_data.13446b8b4567.000000000000003e rbd_id.rbd1 rbd_data.13446b8b4567.0000000000000000 #这样得到的位置信息是错误的 [root@osd2 software]# ceph osd map myrbd hello.txt osdmap e88 pool 'myrbd' (4) object 'hello.txt' -> pg 4.d92fd82b (4.2b) -> up ([4,3], p4) acting ([4,3], p4) #需要加上.rbd [root@osd2 current]# ceph osd map myrbd hello.txt.rbd osdmap e88 pool 'myrbd' (4) object 'hello.txt.rbd' -> pg 4.9b9bf373 (4.73) -> up ([3,1], p3) acting ([3,1], p3) [root@osd2 current]# ssh osd1 [root@osd1 ~]# cd /cephmp2/current/4.73_head/ [root@osd1 4.73_head]# ll -h total 8.0K -rw-r--r-- 1 root root 112 Nov 4 18:08 hello.txt.rbd__head_9B9BF373__4 [root@osd1 4.73_head]# cat hello.txt.rbd__head_9B9BF373__4 <<< Rados Block Device Image >>> rb.0.1365.6b8b4567RBD001.005 #如果是普通的rbd块,format-1类型的rbd块: #ceph osd map test test.img.rbd #format-2类型的rbd块: #ceph osd map test rbd_id.test.img
以上是“ceph中如何定位文件位置”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。