1. 程式人生 > 其它 >【OSD】PG相關命令

【OSD】PG相關命令

PG相關命令

要檢索特定放置組的統計資訊,請執行以下操作:

ceph pg {pg-id} query

這裡的query其實是一種元資料資訊,部分形式如下:

 1 {
 2     "snap_trimq": "[]",
 3     "snap_trimq_len": 0,
 4     "state": "active+clean",
 5     "epoch": 236,
 6     "up": [
 7         1,
 8         2,
 9         0
10     ],
11     "acting": [
12         1,
13         2
, 14 0 15 ], 16 "acting_recovery_backfill": [ 17 "0", 18 "1", 19 "2" 20 ], 21 "info": { 22 "pgid": "1.0", 23 "last_update": "223'23", 24 "last_complete": "223'23", 25 "log_tail": "0'0", 26 "last_user_version": 23, 27 "
last_backfill": "MAX", 28 "purged_snaps": [], 29 "history": { 30 "epoch_created": 2, 31 "epoch_pool_created": 2, 32 "last_epoch_started": 221, 33 "last_interval_started": 220, 34 "last_epoch_clean": 221, 35 "last_interval_clean
": 220, 36 "last_epoch_split": 0, 37 "last_epoch_marked_full": 0, 38 "same_up_since": 220, 39 "same_interval_since": 220, 40 "same_primary_since": 212, 41 "last_scrub": "189'21", 42 "last_scrub_stamp": "2020-12-14T06:56:57.181447+0800", 43 "last_deep_scrub": "189'20", 44 "last_deep_scrub_stamp": "2020-12-13T04:09:17.431508+0800", 45 "last_clean_scrub_stamp": "2020-12-14T06:56:57.181447+0800", 46 "prior_readable_until_ub": 0 47 }, 48 ... 49 }
View Code

我們可以看到很多理論部分講過的元資料,比如 up 、acting、info、epoch、peer、interval等。snap_trimq表示快照刪除佇列。

獲取PG Map:

要獲取特定放置組的放置組對映,請執行以下操作:

ceph pg map {pg-id}

例如:

ceph pg map 1.6c

Ceph將返回放置組圖,放置組和OSD狀態:

osdmap e13 pg 1.6c (1.6c) -> up [1,0] acting [1,0]

解釋一下,這裡表示 pg 1.6c被對映到 編號為 [1,0]的兩個OSD上。 Acting 表示Acting Set。

參考資料:

1. 遷移之美——PG讀寫流程與狀態遷移詳解