处理 unassigned shard

#查看所有分片

GET _cat/shards

 curl  10.1.2.2:9200/_cat/indices/iis_log* #查看索引的分片状态

#查看第一个unassigned shard的原因
GET /_cluster/allocation/explain

#查看iis_qr_2019-07索引中所有分片分配情况
GET /_cat/shards?index=iis_Log_2019-07

#查看unassigned原因:
curl noahes.isec.oa.com/_cluster/allocation/explain?pretty -d '{"index":"index-name","shard":0,"primary":true}'

GET /_cluster/allocation/explain
{
"index": "iis_log_2019-07",
"shard": 0,
"primary": true
}

#shard 自动分配达到最大重试次数5次后,执行reroute命令对分片重新路由,ElasticSearch会自动进行负载均衡
POST /_cluster/reroute?retry_failed=true

1)INDEX_CREATED:由于创建索引的API导致未分配。
2)CLUSTER_RECOVERED :由于完全集群恢复导致未分配。
3)INDEX_REOPENED :由于打开open或关闭close一个索引导致未分配。
4)DANGLING_INDEX_IMPORTED :由于导入dangling索引的结果导致未分配。
5)NEW_INDEX_RESTORED :由于恢复到新索引导致未分配。
6)EXISTING_INDEX_RESTORED :由于恢复到已关闭的索引导致未分配。
7)REPLICA_ADDED:由于显式添加副本分片导致未分配。
8)ALLOCATION_FAILED :由于分片分配失败导致未分配。
9)NODE_LEFT :由于承载该分片的节点离开集群导致未分配。
10)REINITIALIZED :由于当分片从开始移动到初始化时导致未分配(例如,使用影子shadow副本分片)。
11)REROUTE_CANCELLED :作为显式取消重新路由命令的结果取消分配。
12)REALLOCATED_REPLICA :确定更好的副本位置被标定使用,导致现有的副本分配被取消,出现未分配。

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-allocation-explain.html

http://www.mamicode.com/info-detail-2466818.html

原文地址:https://www.cnblogs.com/dreamer-fish/p/11211926.html