获取关闭 API
编辑获取关闭 API
编辑此功能设计为由 Elasticsearch Service、 Elastic Cloud Enterprise 和 Elastic Cloud on Kubernetes 间接使用。不支持直接使用。
检索正在准备关闭的节点的状态。
路径参数
编辑-
<node-id>
- (可选,字符串)正在准备关闭的节点的 ID。如果未指定 ID,则返回正在准备关闭的所有节点的状态。
示例
编辑准备重启节点
resp = client.shutdown.put_node( node_id="USpTGYaBSIKbgSUJR2Z9lg", type="restart", reason="Demonstrating how the node shutdown API works", allocation_delay="10m", ) print(resp)
response = client.shutdown.put_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg', body: { type: 'restart', reason: 'Demonstrating how the node shutdown API works', allocation_delay: '10m' } ) puts response
const response = await client.shutdown.putNode({ node_id: "USpTGYaBSIKbgSUJR2Z9lg", type: "restart", reason: "Demonstrating how the node shutdown API works", allocation_delay: "10m", }); console.log(response);
PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown { "type": "restart", "reason": "Demonstrating how the node shutdown API works", "allocation_delay": "10m" }
获取关闭准备工作的状态
resp = client.shutdown.get_node( node_id="USpTGYaBSIKbgSUJR2Z9lg", ) print(resp)
response = client.shutdown.get_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg' ) puts response
const response = await client.shutdown.getNode({ node_id: "USpTGYaBSIKbgSUJR2Z9lg", }); console.log(response);
GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
响应显示有关关闭准备工作的信息,包括分片迁移、任务迁移和插件清理的状态。
{ "nodes": [ { "node_id": "USpTGYaBSIKbgSUJR2Z9lg", "type": "RESTART", "reason": "Demonstrating how the node shutdown API works", "shutdown_startedmillis": 1624406108685, "allocation_delay": "10m", "status": "COMPLETE", "shard_migration": { "status": "COMPLETE", "shard_migrations_remaining": 0, "explanation": "no shard relocation is necessary for a node restart" }, "persistent_tasks": { "status": "COMPLETE" }, "plugins": { "status": "COMPLETE" } } ] }