溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

ceph常用命令之pool相關(guān)命令有哪些

發(fā)布時(shí)間:2021-11-08 14:14:27 來(lái)源:億速云 閱讀:865 作者:小新 欄目:云計(jì)算

這篇文章將為大家詳細(xì)講解有關(guān)ceph常用命令之pool相關(guān)命令有哪些,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

1.1 查詢系統(tǒng)中所有的pool

命令格式:

ceph osd lspools
或rados lspools

1.2      創(chuàng)建pool

(1)    指定pg數(shù)目、pgp數(shù)目等創(chuàng)建pool

命令格式:

ceph osd pool create <poolname>{pg-num}{pgp-num} {replicated|erasure} {<erasure_code_profile>} {<ruleset>}

命令含義:

 Pool分為replicated pool和erasure code pool,replicate pool以多副本的方式提供數(shù)據(jù)備份,EC pool使用糾刪碼方式提供數(shù)據(jù)安全

 創(chuàng)建erasure pool還可以指定erasure_code_profile,erasure_code_profile 使用命令osd erasure-code-profile set指定,erasure-code-profile參數(shù)含義:

    directory=<dir>         \ # plugin directory absolute path

    plugin=jerasure         \ # plugin name (only jerasure)

    k=<k>                   \ # data chunks (default 2)

    m=<m>                   \ # coding chunks (default 2)

    technique=<technique>   \ # coding technique

 Jerasure 是多種Erasure Coding算法的一個(gè)開源庫(kù),采用C/C++實(shí)現(xiàn),活躍很高,且使用廣,technique可選項(xiàng):reed_sol_van, reed_sol_r6_op, cauchy_orig, cauchy_good, liberation, blaum_roth and liber8tion.

    每個(gè)pg占用一定內(nèi)存和CPU、且PG數(shù)目的增加會(huì)增加peer數(shù)目,因此每個(gè)pool配置的PG數(shù)目有一定的限制,否則會(huì)影響整個(gè)集群的性能,每個(gè)pool大概需要的PG數(shù)目為:

                  (OSDs * 100)

Total PGs =  ------------

                 OSD per object

OSD per object對(duì)于replicated pool來(lái)說(shuō)為副本數(shù),對(duì)于EC pool來(lái)說(shuō)是k+m

(2) 指定uid創(chuàng)建pool

命令格式:

mkpool <pool-name> [123[ 4]]

  命令含義:

創(chuàng)建pool,其擁有者uid為123,crush rule為4

 

1.3 修改pool參數(shù)

命令格式:

ceph osd pool set {pool-name} {key} {value}

命令含義:

Key值含義:

Size:pool副本數(shù)

min_size:pool最小副本數(shù),當(dāng)pool中object副本數(shù)小于min_size, object將停止接收I/O

crash_replay_interval: PG修復(fù)期間,運(yùn)行客戶端重放請(qǐng)求而不提交時(shí)間間隔(單位s,默認(rèn)45s)

pgp_num:使用pgp_num計(jì)算pg id

crush_ruleset:pool使用的crush rule_id,ceph osd crush rule dump可查詢所有配置的策略

auid:設(shè)置pool歸屬用戶id

hit_set_type: cache命中跟蹤類型設(shè)置,默認(rèn)為bloom,其他的類型包括explicit_hash、explicit_object

hit_set_period:

hit_set_count:

hit_set_ fpp:bloom誤檢率

cache_target_dirty_ratio:默認(rèn).4,當(dāng)cache臟數(shù)據(jù)到達(dá)40%,將臟數(shù)據(jù)刷到后端pool中

cache_target_full_ratio:默認(rèn).8,d當(dāng)cache中數(shù)據(jù)量到達(dá)80%,將cache中冷數(shù)據(jù)刪除

target_max_bytes:cache pool最大容量

target_max_objects:cache pool最大存儲(chǔ)的object數(shù)目

cache_min_flush_age: object刷到后端pool的最小年齡,單位為s

cache_min_evict_age:object從cache中刪除的最小年齡,單位為s

1.4 查詢pool參數(shù)

命令格式:

osd pool get <poolname> size|min_size| crash_replay_interval|pg_num|pgp_num| crush_ruleset| 

hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|    

cache_target_dirty_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile

或者使用ceph osd dump |grep pool顯示所有pool的參數(shù)

1.5 刪除pool

命令格式:

ceph osd pool delete {pool-name} [{pool-name} \ [-yes-i-really-really-mean-it]

或

rados rmpool <pool-name> [<pool-name> --yes-i-really-really-mean-it]

命令含義:

刪除pool,當(dāng)pool有數(shù)據(jù)或者配置了用戶等信息,需要將這些信息手動(dòng)刪除掉,否則強(qiáng)制刪除后這些信息還會(huì)在

1.6 重命名pool

命令格式:

ceph osd pool rename {current-pool-name} {new-pool-name}

1.7 查詢pool配額

命令格式

ceph osd pool get-quota <poolname>

命令含義:

查詢pool容量和最大object數(shù)目

1.8 設(shè)置pool配額

命令格式

ceph osd pool set-quota <poolname> max_objects|max_bytes <val>

命令含義:

設(shè)置pool容量和最大object數(shù)目

1.9 查詢pool屬性

命令格式:

ceph osd pool stats {<poolname>}

1.10 創(chuàng)建pool快照

命令格式:

ceph osd pool mksnap <poolname> <snapname>

該命令等同于:
rados mksnap <snapname> -p <poolname>

命令含義: 對(duì)pool中所有的object做快照

1.11 查詢pool快照

命令格式:

rados lssnap –p <poolname>

命令含義:

查詢pool快照

1.12 pool快照回滾

命令格式:

rados rollback <obj-name> <snap-name>  -p < poolname >

命令含義:目前只能針對(duì)pool中某個(gè)object進(jìn)行回滾,不能整個(gè)pool回滾,我們可以考慮自己實(shí)現(xiàn)下?

1.13 cache pool配置和刪除

(1) 將一個(gè)pool配置為另外一個(gè)pool cache命令:

ceph osd tier add <poolname> <cachepoolname>

或

osd tier add-cache <poolname> <cachepoolname> [cachepoolname size

(2) 設(shè)置cache pool模式:

ceph osd pool set <cachepoolname> cache-mode <val>

<val>一共有4個(gè):

‘none’, ‘writeback’, ‘forward’, and ‘readonly’

 ‘writeback’和‘readonly’見2.3節(jié)

  ‘forward’將cache pool關(guān)閉之前,需要將cache pool模式改為’ forward’,不接收客戶端的IO后,才將cache pool數(shù)據(jù)刷到后端pool

(3) 如果將cache pool工作模式設(shè)置為writeback‘,需要執(zhí)行下面命令

Cache pool才能工作,目的將I/O映射到cache pool中

ceph osd tier set-overlay <poolname> <cachepoolname>

(4)將cache pool數(shù)據(jù)刷到后端pool

rados -p {cachepool} cache-flush-evict-all

(5)解除cache pool和后端pool對(duì)應(yīng)關(guān)系

ceph osd tier remove-overlay <cachepoolname>

ceph osd tier remove <poolname> <cachepoolname>

關(guān)于“ceph常用命令之pool相關(guān)命令有哪些”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI