2014-09-30 69 views
5

我有一個ELK堆棧,其中兩個ElasticSearch節點正在運行,並且由於某些未分配的碎片導致集羣狀態變爲紅色,我無法擺脫它。查找未分配的分片,分別。不完整的指數與:擺脫未分配的碎片

# 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 
} 

謝謝您的時間,並幫助

+0

您是否曾經找到過解決方案? – 2017-02-17 16:54:01

+0

刪除碎片並丟失數據是解決它的唯一方法,那時候 – pagid 2017-02-19 16:20:39

回答

0

我居然遇到了這種情況與ElasticSearch 1.5只是一天。在最初得到同樣的錯誤之後,我只需要重複/_cluster/reroute由於缺乏其他想法而請求第二天,它就起作用,並立即將羣集恢復爲綠色狀態。