这篇文章主要为大家展示了“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.rpmosdmap 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# idweighttype nameup/downreweight-110.92root default-23.64host mon001.82osd.0up111.82osd.1up1-33.64host osd121.82osd.2up131.82osd.3up1-43.64host osd241.82osd.4up151.82osd.5up1[root@osd2 software]# cd /cephmp1/current/4.be_head/[root@osd2 4.be_head]# lsepel.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 -htotal 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.txtImporting image: 100% complete...done.[root@osd2 software]# rbd info myrbd/hello.txtrbd image 'hello.txt':size 12 bytes in 1 objectsorder 22 (4096 kB objects)block_name_prefix: rb.0.1365.6b8b4567format: 1[root@osd2 software]# rados ls -p myrbdrbd_data.13446b8b4567.00000000000000barbd_directoryrbd_data.13446b8b4567.000000000000007drbd_data.13446b8b4567.000000000000007crbd_data.13446b8b4567.000000000000005drbd_data.13446b8b4567.000000000000007erbd_data.13446b8b4567.00000000000000ffrb.0.1365.6b8b4567.000000000000hello.txt.rbdrbd_data.13446b8b4567.00000000000000d9rbd_data.13446b8b4567.00000000000000f8rbd_data.13446b8b4567.000000000000009brbd_data.13446b8b4567.0000000000000001rbd_header.13446b8b4567epel.rpmrbd_data.13446b8b4567.000000000000001frbd_data.13446b8b4567.000000000000003erbd_id.rbd1rbd_data.13446b8b4567.0000000000000000#这样得到的位置信息是错误的[root@osd2 software]# ceph osd map myrbd hello.txtosdmap 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.rbdosdmap 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 -htotal 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中如何定位文件位置”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注编程网行业资讯频道!