客户端停写
1、关闭集群shard allocation
{"acknowledged":true,"persistent":{"cluster":{"routing":{"allocation":{"enable":"none"}}}},"transient":{}}
2、执行同步刷新
{"_shards":{"total":0,"successful":0,"failed":0}}
3、停es集群进程
4、重新开启集群shard allocation
{"acknowledged":true,"persistent":{"cluster":{"routing":{"allocation":{"enable":"all"}}}},"transient":{}}
如果有kibana客户端,可以用一下方法:
1 客户端停写
1.1 关闭集群shard allocation
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "none"
}
}
1.2 执行同步刷新
POST _flush/synced
1.3 停es服务
2 启es集群操作
2.1 启动es服务
2.2 重新开启集群shard allocation
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "all"
}
}