ES分片状态为灰色Unassigned的2种处理方法

ES分片状态为灰色Unassigned的2种处理方法

目录

 [显示

文档应对场景

当EZSonar服务器异常断电重启后,通过ES状态管理界面查看索引Shard分片出现状态为灰色Unassigned状态,可以通过下列步骤进行应对操作。

ES状态管理界面为:http://服务IP:9200/_plugin/head/

基本术语解释

图片1Unassigned状态.png

  • 图示1,EZS_176,node节点名称;
  • 图示2,0,1,2,Shard(分片)编号;
  • 图示3,loadtest,index索引名

分片状态为灰色Unassigned的2种处理方法

如果分片处于灰色Unassigned状态,可以通过2种方式进行处理;

1. 等待一段时间,shard分片会自动恢复成【已分配】状态,耗时视异常掉电的影响而定;

2. 如果一段时间后shard分片仍然处于灰色Unassigned状态,则可以通过人工操作的方式,将Unassigned的shard分片分配给节点。

演示案例

图片2Unassigned状态.png对索引loadtestshard0、shard1loadtest-2015-06-10shard0、shard1,分配给节点EZS_176

需要人工操作的shard分片有4个,因此要分别运行4次命令。

命令效果:将索引loadtest的shard0,分配给EZS_176;
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{     "commands" : [  {           "allocate" : {               "index" : "loadtest", "shard" : 0, "node" : "EZS_176"           }         }     ] }' 
命令效果:将索引loadtest的shard1,分配给EZS_176;
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{     "commands" : [  {           "allocate" : {               "index" : "loadtest", "shard" : 1, "node" : "EZS_176"           }         }     ] }' 
命令效果:将索引loadtest-2015-06-10的shard0,分配给EZS_176;
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{     "commands" : [  {           "allocate" : {               "index" : "loadtest-2015-06-10", "shard" : 0, "node" : "EZS_176"           }         }     ] }' 
命令效果:将索引loadtest-2015-06-10的shard1,分配给EZS_176;
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{     "commands" : [  {           "allocate" : {               "index" : "loadtest-2015-06-10", "shard" : 1, "node" : "EZS_176"           }         }     ] }'

猜你喜欢

转载自www.cnblogs.com/zhangyunfei-blog/p/9288416.html