小編給大家分享一下ceph-rest-api怎么用,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
創(chuàng)新互聯(lián)建站專(zhuān)業(yè)為企業(yè)提供九龍坡網(wǎng)站建設(shè)、九龍坡做網(wǎng)站、九龍坡網(wǎng)站設(shè)計(jì)、九龍坡網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、九龍坡企業(yè)網(wǎng)站模板建站服務(wù),十多年九龍坡做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
0.67-10.x版本如果需要集成現(xiàn)有業(yè)務(wù)可以考慮這個(gè)內(nèi)置的rest接口,從12.x開(kāi)始這個(gè)接口將被內(nèi)置的mgr模塊替代,后期可能會(huì)被移除,所以高版本就不要用這個(gè)接口了。
root@demohost:/home/user# ceph-rest-api -c /etc/ceph/ceph.conf -n client.admin --cluster ceph * Running on http://0.0.0.0:5000/
#獲取rbd pool的屬性
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/osd/pool/get?pool=rbd\&var=size
size: 1
#獲取支持的屬性列表
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/osd/pool/get?pool=rbd\&var
var not in size|min_size|crash_replay_interval|
pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|
nopgchange|nosizechange|write_fadvise_dontneed|noscrub|
nodeep-scrub|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_dirty_high_ratio|
cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|
erasure_code_profile|min_read_recency_for_promote|all|
min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|
hit_set_search_last_n|scrub_min_interval|scrub_max_interval|
deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority
#新建pool,名稱(chēng)為rbd1,pg和pgp的數(shù)量為10
curl http://0.0.0.0:5000/api/v0.1/osd/pool/create?pool=rbd1\&pg_num=10\&pgp_num=10 -X PUT -v
# 獲取rule 列表
curl http://0.0.0.0:5000/api/v0.1/osd/crush/rule/list
# 獲取rule詳情
curl http://0.0.0.0:5000/api/v0.1/osd/crush/rule/dump
# 修改rbd1 pool的crush ruleset為1
curl http://0.0.0.0:5000/api/v0.1/osd/pool/set?pool=rbd1\&var=crush_ruleset\&val=1 -X PUT -v
第一步,新建用戶client.user1的keyring,內(nèi)容如下
root@demohost:/usr/lib/python2.7/dist-packages# cat /tmp/user1.keyring [client.user1] key = AQCtsihaEUozABAAPPDTEhSNJMkj4HOp+nJeaQ== caps mds = "allow" caps mon = "allow *" caps osd = "allow *"
第二步,通過(guò)rest-api導(dǎo)入用戶
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/auth/import -X PUT -T /tmp/user1.keyring
第三步,查看用戶信息
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/auth/get?entity=client.user1 [client.user1] key = AQCtsihaEUozABAAPPDTEhSNJMkj4HOp+nJeaQ== caps mds = "allow" caps mon = "allow *" caps osd = "allow *
查看用戶列表
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/auth/list osd.0 key: AQDJ0adZpVCPIhAA8z/qYSPEX6Hn699piAS3bQ== caps: [mon] allow rwx caps: [osd] allow * osd.1 key: AQDK0adZNNGUMhAA06qcr+Dq59JmIZs1po/3uA== caps: [mon] allow rwx caps: [osd] allow * osd.2 key: AQDM0adZgcG6BhAA1s4yaZf323uGpuMazV3JXQ== caps: [mon] allow rwx caps: [osd] allow * client.user1 key: AQCtsihaEUozABAAPPDTEhSNJMkj4HOp+nJeaQ== caps: [mds] allow caps: [mon] allow * caps: [osd] allow *
查看集群狀態(tài)
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/health?detail=detail HEALTH_OK
查看集群fsid
root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/fsid f8c4249f-2b96-43ca-8587-2f4127a252bf
以上是“ceph-rest-api怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!