elasticsearch. guide

关闭节点 API

可以用这个 API 关闭集群中的一个或多个(甚至全部)节点。下面的命令关闭了 _local 节点:

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'

也可以用节点id发起关闭指令 (或者 这里 提到的节点选择方法):

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown'

集群的主节点可以这样关闭:

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_master/_shutdown'

关闭所有节点可以用如下指令:

$ curl -XPOST 'http://localhost:9200/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_shutdown'

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_all/_shutdown'

延迟

默认情况下,关闭动作将在收到指令 (1s) 秒后执行. 可以用 delay 参数设定延迟的时长. 比如:

$ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown?delay=10s'
 
Fork me on GitHub