Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use ceph-rest-api

Shulou Source: shulou.com Published: 2022-05-31 18:35:57 10月03日 Update

Editor to share with you how to use ceph-rest-api, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Version problem

Version 0.67-10.x if you need to integrate existing services, you can consider this built-in rest interface, which will be replaced by the built-in mgr module from 12.x and may be removed later, so do not use this interface in the higher version.

two。 Service startup 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/3.pool related operation # get root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/osd/pool/get?pool=rbd\&var=sizesize: attributes of rbd pool Get the list of supported attributes root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/osd/pool/get?pool=rbd\&varvar 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# new pool, whose name is rbd1 The number of pg and pgp is 10curl http://0.0.0.0:5000/api/v0.1/osd/pool/create?pool=rbd1\&pg_num=10\&pgp_num=10-X PUT-v# get rule list curl http://0.0.0.0:5000/api/v0.1/osd/crush/rule/list# get rule details curl http://0.0.0.0:5000/api/v0.1/osd/crush/rule/dump # modify crush ruleset of rbd1 pool to 1curl http://0.0.0.0:5000/api/v0.1/osd/pool/set?pool=rbd1\&var=crush_ruleset\&val=1-X PUT-v4. User management related operations create new users (keyring mode)

The first step is to create a new keyring for user client.user1, as follows

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 *"

The second step is to import users through 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

The third step is to view user information

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 *"

View a list of users

Root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/auth/listosd.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 * 5. Other actions

View cluster status

Root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/health?detail=detailHEALTH_OK

View cluster fsid

Root@demohost:/usr/lib/python2.7/dist-packages# curl http://0.0.0.0:5000/api/v0.1/fsidf8c4249f-2b96-43ca-8587-2f4127a252bf above is all the content of this article "how to use ceph-rest-api". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: User content interface version article attribute cluster not much business information name most quantity method more module status knowledge industry details Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL macOS Microsoft Shulou Tech Info