2013-08-23 48 views
2

我的安裝工作正常,但由於其中顯示了2個「額外」未分配的分片,因此一個索引顯示黃色健康。我如何刪除這些額外的碎片?我目前的設置是0個副本和2個分片。刪除未分配的彈性搜索分片

curl -XGET 'http://localhost:9200/_cluster/health/tags?level=shards&pretty=true' 
{ 
    "cluster_name" : "elasticsearch_inspire", 
    "status" : "yellow", 
    "timed_out" : false, 
    "number_of_nodes" : 1, 
    "number_of_data_nodes" : 1, 
    "active_primary_shards" : 2, 
    "active_shards" : 2, 
    "relocating_shards" : 0, 
    "initializing_shards" : 0, 
    "unassigned_shards" : 2, 
    "indices" : { 
    "v1_tags" : { 
     "status" : "yellow", 
     "number_of_shards" : 2, 
     "number_of_replicas" : 1, 
     "active_primary_shards" : 2, 
     "active_shards" : 2, 
     "relocating_shards" : 0, 
     "initializing_shards" : 0, 
     "unassigned_shards" : 2, 
     "shards" : { 
     "0" : { 
      "status" : "yellow", 
      "primary_active" : true, 
      "active_shards" : 1, 
      "relocating_shards" : 0, 
      "initializing_shards" : 0, 
      "unassigned_shards" : 1 
     }, 
     "1" : { 
      "status" : "yellow", 
      "primary_active" : true, 
      "active_shards" : 1, 
      "relocating_shards" : 0, 
      "initializing_shards" : 0, 
      "unassigned_shards" : 1 
     } 
     } 
    } 
    } 
} 

回答

2

最近,我有這個問題,即ES進程的所有節點上重新啓動,我還有一些未分配的碎片(集羣健康爲紅色)。 我做了以下手動分配的碎片和沒有的伎倆,我(是不需要重新啓動)

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ 
    "commands": [ 
    { 
     "allocate": { 
     "index": "INDEXNAME", 
     "shard": "SHARDNUMBER", 
     "node": "PICKANODE", 
     "allow_primary": 1 
     } 
    } 
    ] 
}' 
+0

你能不能過這是什麼一樣雙tmore走路嗎?假設你在indexname/shardnumber /節點 – Kevin

+0

中放入了具體的值。我有幾個未分配的碎片,如下所示:「unassigned」:['state':'UNASSIGNED', 「primary」:false, 「node」:null, 「relocating_node」:null, 「shard」:0, 「index」:「logstash-2014.01.14」 }, 在提到的命令中,我輸入了indexname作爲logstash-2014.01.14,shard爲0,節點:來自我的3節點羣集的任何節點名稱。 – APZ

0

重新啓動節點似乎是解決它的唯一方法。

如果任何人有攻擊性較小的解決方案,請張貼:)