获取关闭 API
编辑获取关闭 API编辑
此功能专为间接使用而设计,例如 Elasticsearch Service、Elastic Cloud Enterprise 和 Elastic Cloud on Kubernetes。不支持直接使用。
检索正在准备关闭的节点的状态。
路径参数编辑
-
<node-id>
- (可选,字符串)正在准备关闭的节点的 ID。如果未指定 ID,则返回正在准备关闭的所有节点的状态。
查询参数编辑
示例编辑
准备要重启的节点
response = client.shutdown.put_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg', body: { type: 'restart', reason: 'Demonstrating how the node shutdown API works', allocation_delay: '10m' } ) puts response
PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown { "type": "restart", "reason": "Demonstrating how the node shutdown API works", "allocation_delay": "10m" }
获取关闭准备工作的状态
response = client.shutdown.get_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg' ) puts 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" } } ] }