Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to know the location of an Object in Ceph

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to know the storage location of an Object in Ceph, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

In ceph, the data is averagely split into Object of 4MB (default), and then stored in OSD through the process of Pool-- (crush)-> PG-- > OSD.

So how can I get the location of an Object?

First, store an Object

To store an Object in a ceph cluster, you need to know:

Object's name, name.

Specify the pool name where you want to store the Object

Look at the pools, where the pool of "testpool" is used.

# rados lspools

Rbd

Testpool

Create a new "test.txt" file, generate an Object named "test-object-1", and write to "testpool"

# echo "test data" > test.txt

# rados put test-object-1 test.txt-pool=testpool

View the Object

# rados-p testpool ls

Rbd_directory

Rbd_id.bar

Rbd_data.5e3b248a65f6.0000000000000083

Rbd_data.5e3b248a65f6.0000000000000080

Rbd_data.5e3b248a65f6.00000000000000e0

Rbd_data.5e3b248a65f6.0000000000000087

Rbd_data.5e3b248a65f6.0000000000000000

Rbd_data.5e3b248a65f6.00000000000000ff

Rbd_data.5e3b248a65f6.0000000000000084

Rbd_data.5e3b248a65f6.00000000000000a0

Rbd_data.5e3b248a65f6.0000000000000060

Rbd_data.5e3b248a65f6.0000000000000021

Rbd_data.5e3b248a65f6.0000000000000004

Rbd_data.5e3b248a65f6.0000000000000085

Rbd_data.5e3b248a65f6.0000000000000081

Rbd_data.5e3b248a65f6.0000000000000020

Rbd_data.5e3b248a65f6.0000000000000086

Rbd_data.5e3b248a65f6.0000000000000082

Test-object-1

Rbd_header.5e3b248a65f6

See where the Object is stored in the ceph cluster.

# ceph osd map testpool test-object-1

Osdmap e95 pool' testpool' (1) object 'test-object-1'-> pg 1.74dc35e2 (1.1e2)-> up ([4jue 1], p4) acting ([4jue 1], p4)

The above output shows that under "epoch 95"-> pool number 1 "testpool'" in osdmap, the object of "'test-object-1" is stored in PG "1.74dc35e2 (1.1e2)", its osd is osd.4 and osd.1, and osd.4 is Primary osd.

2. Check osdmap

Get the binary file of osdmap

# sudo ceph osd getmap-o osds.map

Got osdmap epoch 95

View osdmap in text mode

# osdmaptool-print osds.map

Osdmaptool: osdmap file 'osds.map'

Epoch 95

Fsid ced59665-9de8-42b7-b2c3-5a19cffe97c7

Created 2016-03-25 21 1314 13.595390

Modified 2016-03-31 12 purl 36 purl 39.588974

Flags sortbitwise

Pool 0 'rbd' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 128 pgp_num 128 last_change 16 flags hashpspool stripe_width 0

Pool 1 'testpool' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 512 pgp_num 512 last_change 95 flags hashpspool stripe_width 0

Removed_snaps [1x 3]

Max_osd 6

Osd.0 up in weight 1 up_from 77 up_thru 88 down_at 70 last_clean_interval [54 Magazine 61) 10.167.225.35 down_at 6812 exists,up 5c0194c3-351b-4ce9-9864-083819a3e0cb

Osd.1 up in weight 1 up_from 74 up_thru 91 down_at 70 last_clean_interval [51 Magi 61) 10.167.225.35 osd.1 up in weight 6808 4ea5 3668 10.167.225.35 osd.1 up in weight 6809 9c5e6f46ec44 3668 10.167.225.35 1810 9c5e6f46ec44

Osd.2 up in weight 1 up_from 68 up_thru 89 down_at 67 last_clean_interval 10.167.225.35 osd.2 up in weight 3107 10.167.225.35 osd.2 up in weight 6805 4f66-bf5c-71fa0b37bf2f 3107 10.167.225.35 3107 10.167.225.35

Osd.3 up in weight 1 up_from 63 up_thru 89 down_at 62 last_clean_interval 10.167.225.35 osd.3 up in weight 6801 2728 10.167.225.35 osd.3 up in weight 6801 2728 10.167.225.35 osd.3 up in weight 6802 2728 10.167.225.35 osd.3 up in weight 6803 2728 exists,up edaf6eda-6683-

Osd.4 up in weight 1 up_from 85 up_thru 90 down_at 80 last_clean_interval [71 Magne84) 10.167.225.63 exists,up f57ba6b1 6804 4bfc-930f-42adbdd036fb 3048 10.167.225.63 up_thru 6808 4bfc-930f-42adbdd036fb 1003048 10.167.225.63 6809 4bfc-930f-42adbdd036fb 1003048 10.167.225.63

Osd.5 up in weight 1 up_from 85 up_thru 91 down_at 80 last_clean_interval 10.167.225.63 last_clean_interval 6800 exists,up 583e265c-11c1 2559 10.167.225.63 osd.5 up in weight 6805 exists,up 583e265c-11c1 1002559 10.167.225.63 Villa 6807 7c9a58d0f463 1002559 10.167.225.63

Delete an Object

Use the following rados rm command to remove the object with that name from pool.

# rados rm test-object-1-pool=testpool

Thank you for reading this article carefully. I hope the article "how to know the location of an Object in Ceph" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report