2.3. 管理集群
本节介绍如何使用 RESTful 插件对 OSD 初始化清理或深度清理、创建池或删除池中的数据、删除请求或创建请求:
2.3.1. 如何才能在 OSD 上运行调度的进程? 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
本节介绍如何使用 RESTful API 在 OSD 上运行调度的进程,如清理或深度清理。
curl
命令
在命令行中使用:
echo -En '{"command": "<command>"}' | curl --request POST --data @- --silent --user <user> 'https://<ceph-mgr>:8003/osd/<id>/command'
echo -En '{"command": "<command>"}' | curl --request POST --data @- --silent --user <user> 'https://<ceph-mgr>:8003/osd/<id>/command'
替换:
-
命令
包含您要启动的进程(清理
、深度
清理或修复
)。验证 OSD 上支持该进程。详情请查看 第 2.1.9 节 “如何确定哪些进程可以在 OSD 上调度?”。 -
<user>
with user name -
<ceph-mgr>
,带有活跃的ceph-mgr
实例,节点的 IP 地址或短主机名 -
<id>
带有osd
字段中列出的 OSD 的 ID
出现提示时,输入用户的密码。
如果您使用自签名证书,请使用 --insecure
选项:
echo -En '{"command": "<command>"}' | curl --request POST --data @- --silent --insecure --user <user> 'https://<ceph-mgr>:8003/osd/<id>/command'
echo -En '{"command": "<command>"}' | curl --request POST --data @- --silent --insecure --user <user> 'https://<ceph-mgr>:8003/osd/<id>/command'
Python
在 Python 解释器中输入:
python > import requests > result = requests.post('https://<ceph-mgr>:8003/osd/<id>/command', json={"command": "<command>"}, auth=("<user>", "<password>")) > print result.json()
$ python
>> import requests
>> result = requests.post('https://<ceph-mgr>:8003/osd/<id>/command', json={"command": "<command>"}, auth=("<user>", "<password>"))
>> print result.json()
替换:
-
<ceph-mgr>
,带有活跃的ceph-mgr
实例,节点的 IP 地址或短主机名 -
<id>
带有osd
字段中列出的 OSD 的 ID -
命令
包含您要启动的进程(清理
、深度
清理或修复
)。验证 OSD 上支持该进程。详情请查看 第 2.1.9 节 “如何确定哪些进程可以在 OSD 上调度?”。 -
<user>
with user name -
<password>
和用户的密码
如果您使用自签名证书,请使用 verify=False
选项:
python > import requests > result = requests.post('https://<ceph-mgr>:8003/osd/<id>/command', json={"command": "<command>"}, auth=("<user>", "<password>"), verify=False) > print result.json()
$ python
>> import requests
>> result = requests.post('https://<ceph-mgr>:8003/osd/<id>/command', json={"command": "<command>"}, auth=("<user>", "<password>"), verify=False)
>> print result.json()