elasticsearch status red问题解决

业务自己搭建了一套elasticsearch服务,最近几天查询开始变的越来越不稳定。

查看健康度发现status已经变成了red。

[root@localhost ~]# curl 'http://xxx.xxx.xxx.xxx:9200/_cluster/health?pretty'           
{
  "cluster_name" : "imageIndex",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 4,
  "number_of_data_nodes" : 4,
  "active_primary_shards" : 4,
  "active_shards" : 6,
  "relocating_shards" : 1,
  "initializing_shards" : 0,
  "unassigned_shards" : 4,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 10
}
[root@localhost ~]#

问了下朋友,说是重启所有节点看看。

  1. 停止所有节点服务

    curl -XPOST 'http://xxx.xxx.xxx.xxx:9200/_cluster/nodes/_shutdown'
  2. 分别启动每一个节点

    ./bin/elasticsearch -d
  3. 查看健康度

    [user_00@localhost ~]$ curl 'http://xxx.xxx.xxx.xxx:9200/_cluster/health?pretty'
    {
      "cluster_name" : "imageIndex",
      "status" : "yellow",
      "timed_out" : false,
      "number_of_nodes" : 4,
      "number_of_data_nodes" : 4,
      "active_primary_shards" : 5,
      "active_shards" : 5,
      "relocating_shards" : 0,
      "initializing_shards" : 5,
      "unassigned_shards" : 0,
      "delayed_unassigned_shards" : 0,
      "number_of_pending_tasks" : 0,
      "number_of_in_flight_fetch" : 0
    }

参考资料:
集群健康
elasticsearch如何安全重启节点(续)

标签: elasticsearch

添加新评论