查看集群健康状态:curl -XGET http://localhost:9200/_cluster/health\?pretty
图中显示,有0个分片未分配节点
*****************************开始修复************************************
1、查看所有分片状态:curl -XGET http://localhost:9200/_cat/shards (显示所有分片状态);curl -s "http://localhost:9200/_cat/shards" | grep UNASSIGNED (只显示为分配节点)
2、查看master节点的唯一标识:curl 'localhost:9200/_nodes/process?pretty'
3、执行reroute(分多次,逐个修复 变更shard的值为UNASSIGNED查询结果中编号, 上一步查询结果是/0 1 2 3 4)
inde:需要修复的索引的名字(这里需要修复三个索引)
shard:shard的编号,图中可以看出
node:master节点的唯一标识
curl -XPOST 'guard3:9200/_cluster/reroute' -d '{
"commands" : [{
"allocate" : {
"index" : "statistic_guard_hour_url_sm4_20210828",
"shard" : 4,
"node" : "WAJHc6JnTgGcol3JdCH7Zw",
"allow_primary" : true
}
}]
}'
————————————————
原文链接:https://blog.youkuaiyun.com/envinfo2012/article/details/82767674