摆脱未分配的碎片

时间:2014-09-30 20:57:52

标签: elasticsearch sharding

我有一个运行两个ElasticSearch节点的ELK堆栈,由于一些未分配的分片,群集状态变为红色,我无法摆脱它。查找未分配的碎片,resp。不完整的索引:

# curl -s elastic01.local:9200/_cat/shards | grep "logstash-2014.09.29"

节目:

logstash-2014.09.29 4 p STARTED       745489  481.3mb 10.165.98.107 Crimson and the Raven
logstash-2014.09.29 4 r STARTED       745489  481.3mb 10.165.98.106 Glenn Talbot
logstash-2014.09.29 0 p STARTED       781110  502.3mb 10.165.98.107 Crimson and the Raven
logstash-2014.09.29 0 r STARTED       781110  502.3mb 10.165.98.106 Glenn Talbot
logstash-2014.09.29 3 p INITIALIZING                  10.165.98.107 Crimson and the Raven
logstash-2014.09.29 3 r UNASSIGNED
logstash-2014.09.29 1 p STARTED       762991  490.1mb 10.165.98.107 Crimson and the Raven
logstash-2014.09.29 1 r STARTED       762991  490.1mb 10.165.98.106 Glenn Talbot
logstash-2014.09.29 2 p STARTED       761811  491.3mb 10.165.98.107 Crimson and the Raven
logstash-2014.09.29 2 r STARTED       761811  491.3mb 10.165.98.106 Glenn Talbot

我尝试将分片分配给另一个节点失败:

curl XPOST -s 'http://elastic01.local:9200/_cluster/reroute?pretty=true' -d '{
    "commands" : [ {
            "allocate" : {
              "index" : "logstash-2014.09.29",
              "shard" : 3 ,
              "node" : "Glenn Talbot",
              "allow_primary" : 1
            } 
        }
    ]
}'

使用:

NO(primary shard is not yet active)]

我似乎无法找到一个API来进一步推动分片状态。我怎么能在这里继续?

只是为了全面了解系统运行状况:

{
  "cluster_name" : "logstash_es",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 114,
  "active_shards" : 228,
  "relocating_shards" : 0,
  "initializing_shards" : 1,
  "unassigned_shards" : 1
}

感谢您的时间和帮助

1 个答案:

答案 0 :(得分:0)

我实际上是在前几天遇到ElasticSearch 1.5的情况。在最初得到相同的错误之后,由于缺乏其他想法,我在第二天重复 .indexOf()请求,并且它有效,并且它立即使群集恢复为绿色状态。 / p>