实例
更新时间:2025-08-20
启动实例
使用以下代码可以启动一个ES实例或者kibana实例。
Text
1def start_instance_example(self):
2 cluster_id = 'your cluster id'
3 instance_id = 'your instance id'
4 response = client.start_instance(cluster_id=cluster_id, instance_id=instance_id)
5 if response.success:
6 # 执行成功
7 print(response.status) # http响应码
8 else:
9 # 执行失败
10 print(
11 response.status, # http响应码
12 response.code, # 错误码
13 response.error.message # 报错信息
14 )
15}
请求参数说明
| 名称 | 类型 | 是否必须 | 参数描述 |
|---|---|---|---|
| cluster_id | str | 是 | 集群Id |
| instance_id | str | 是 | 节点Id |
返回结果说明
response
| 名称 | 类型 | 参数描述 |
|---|---|---|
| success | bool | 操作是否成功 |
| status | int | 状态码 |
| result | str | 常量字符串 |
停止实例
使用以下代码可以停止一个ES实例或者kibana实例。
Text
1def stop_instance_example(self):
2 cluster_id = 'your cluster id'
3 instance_id = 'your instance id'
4 response = client.stop_instance(cluster_id=cluster_id, instance_id=instance_id)
5 if response.success:
6 # 执行成功
7 print(response.status) # http响应码
8 else:
9 # 执行失败
10 print(
11 response.status, # http响应码
12 response.code, # 错误码
13 response.error.message # 报错信息
14 )
15}
请求参数说明
| 名称 | 类型 | 是否必须 | 参数描述 |
|---|---|---|---|
| cluster_id | str | 是 | 集群Id |
| instance_id | str | 是 | 节点Id |
返回结果说明
response
| 名称 | 类型 | 参数描述 |
|---|---|---|
| success | bool | 操作是否成功 |
| status | int | 状态码 |
| result | str | 常量字符串 |
