2014-01-09 48 views
3

我最近有一個SNAFU導致我的集羣以裂腦結束(儘管有很多控制)導致基本上被破壞的碎片。我已經把所有的節點恢復到正常的狀態,認出了正確的主人等等,但是羣集仍然是紅色的,並且是正確的;有幾個碎片沒有家。如何刪除ElasticSearch索引的特定分片

用我RubberBand script後,我能夠用VisualJSON找到碎片像下面的一個,有沒有節點探索:

{ 
    "index": "logstash-2013.12.27", 
    "node": null, 
    "primary": false, 
    "relocating_node": null, 
    "shard": 4, 
    "state": "UNASSIGNED" 
}, 

我想刪除它們,但我似乎無法找到一個API調用來刪除分片,只刪除整個索引或使用查詢。提前致謝!

+0

AFAIK,沒有這樣的事情。嘗試重新啓動節點,看看它是否重新分配。如果損壞是永久性的,我想你必須刪除該索引。 – shyos

+1

你是對的:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-reroute.html使用這個命令並給它一個分片將允許你「分配」一個分片沒有分配或有節點。你不能刪除。 – Spanky

+0

很酷,不知道。 – shyos

回答

7
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ 
    "commands": [ 
    { 
     "allocate": { 
     "index": "tweedle-2013.12.21", 
     "shard": 3, 
     "node": "efsKb4DzQ2iaIfKfu36vsA", 
     "allow_primary": true 
     } 
    } 
    ] 
}' 

此命令將需要一個孤立的碎片,並將它指定在一行節點efsKb4DzQ2iaIfKfu36vsA

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ 
    "commands": [ 
    { 
     "allocate": { 
     "index": "tweedle-2013.12.21", 
     "shard": 3, 
     "node": "efsKb4DzQ2iaIfKfu36vsA", 
     "allow_primary": true 
     } 
    } 
    ] 
}' 
相關問題