[elasticsearch] unassinged shard reroute...

Elastic/Elasticsearch 2013. 11. 13. 15:05

간혹 shard unassigned 되는 경우가 있습니다.

실제 데이터가 깨진게 아니라면 reroute 를 통해서 노드에 할당해 주시면 됩니다.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-reroute.html

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
   
"commands" : [ {
       
"move" :
           
{
             
"index" : "test", "shard" : 0,
             
"from_node" : "node1", "to_node" : "node2"
           
}
       
},
       
{
         
"allocate" : {
             
"index" : "test", "shard" : 1, "node" : "node3"
         
}
       
}
   
]
}'


curl -XPOST 'http://localhost:9200/_cluster/reroute' -d '{"commands" : [ {"allocate" : {"index" : "index_test", "shard" : 13, "node" : "genie1", "allow_primary" : true}}]}'


- allow_primary 가 설정 되어 있지 않을 경우 primary shard 는 할당 할 수 없습니다.

: