Elasticsearch集群迁移状态问题
上周因业务需要,需要把业务从H机房迁移至B机房,因为是离线数据,所以迁移也比较简单,直接节点及相差数据拷贝过去,然后环境准备一样,即可启动,完成迁移,可是在B机房启动ES集群后,发现状态不对
$ curl -XGET https://172.22.7.11:9200/_cluster/health\?pretty
{
"cluster_name" : "BIG-log-sale",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 71,
"active_shards" : 119,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 27,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 81.5068493150685
}
Es中用三种颜色状态表示:green,yellow,red。
Green:所有主分片和副本分片都可用;
Yellow:所有主分片可用,但不是所有副本分片都可用;
Red:不是所有的主分片都可用。
我的这个问题的解决办法可以找到master节点,执行reroute,但我没有这么做,我怀疑可能数据拷贝的也有问题,所以想先重新拷贝一下数据,如果不行,在执行reroute。
重新拷贝之后,在启动观察状态,果然好了
$ curl '172.22.7.11:9200/_cat/health?v'
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1526537559 14:12:39 BIG-log-sale green 2 2 146 97 0 0 0 0 - 100.0%
参考:
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html
评论