Elasticsearch集群UNASSIGNED shareds问题 修复
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch集群UNASSIGNED shareds问题 修复相关的知识,希望对你有一定的参考价值。
线上有3台es组成集群,其他有两台非正常关机了,早上过来发现集群状态为红色,提示"24 UNASSIGNED shareds":
1)查看集群相关信息:
curl ‘localhost:9200/_nodes/process?pretty‘
记下这个node的id号;
2)然后找出UNASSIGNED 的相关信息,方便后续修改!
# curl -XGET http://localhost:9200/_cat/shards|grep UNASSIGNED
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 30528 100 30528 0 0 705k 0 --:--:-- --:--:-- --:--:-- 745k
graylog_83 1 p UNASSIGNED
graylog_83 1 r UNASSIGNED
graylog_83 0 p UNASSIGNED
graylog_83 0 r UNASSIGNED
graylog_82 1 p UNASSIGNED
graylog_82 1 r UNASSIGNED
graylog_85 2 p UNASSIGNED
graylog_85 2 r UNASSIGNED
graylog_85 1 p UNASSIGNED
graylog_85 1 r UNASSIGNED
graylog_84 0 p UNASSIGNED
graylog_84 0 r UNASSIGNED
graylog_87 1 p UNASSIGNED
graylog_87 1 r UNASSIGNED
graylog_86 3 p UNASSIGNED
graylog_86 3 r UNASSIGNED
graylog_86 1 p UNASSIGNED
graylog_86 1 r UNASSIGNED
graylog_89 3 p UNASSIGNED
graylog_89 3 r UNASSIGNED
graylog_88 1 p UNASSIGNED
graylog_88 1 r UNASSIGNED
graylog_88 0 p UNASSIGNED
graylog_88 0 r UNASSIGNED
3)然后依次修改以上UNASSIGNED ,命令为:
curl -XPOST ‘localhost:9200/_cluster/reroute‘ -d ‘{
"commands" : [ {
"allocate" : {
"index" : "graylog_83",
"shard" : 1,
"node" : "Auq82gfGQVWgOBw6S7ajRQ",
"allow_primary" : true
}
}]
}‘
PS:
index就是索引的名称:也就是graylog_88,graylog_86,graylog_87.....
node:就是在哪个节点上执行;
shared:分片的编号!
本文出自 “shine_forever的博客” 博客,请务必保留此出处http://shineforever.blog.51cto.com/1429204/1859734
以上是关于Elasticsearch集群UNASSIGNED shareds问题 修复的主要内容,如果未能解决你的问题,请参考以下文章
elasticsearch问题解决之分片副本UNASSIGNED
解决elasticsearch集群Unassigned Shards 无法reroute的问题
Elasticsearch unassigned shard
elasticsearch 创建索引unassignedelasticsearch 创建索引后出现unassigned