小编给大家分享一下ceph-rest-api怎么用,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
0.67-10.x版本如果需要集成现有业务可以考虑这个内置的rest接口,从12.x开始这个接口将被内置的mgr模块替代,后期可能会被移除,所以高版本就不要用这个接口了。
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,名称为rbd1,pg和pgp的数量为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,内容如下
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 *"
第二步,通过rest-api导入用户
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 *
查看集群状态
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怎么用”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。