记一次es 集群red的排查解决过程

问题现象:es 集群状态red,查看基本信息以下:curl

解决过程:url

1- 查看未分配分片信息code

GET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason

 2- 首先设置全部索引副本个数全为0blog

curl -XPUT "http://localhost:9200/_settings" -d' {  "number_of_replicas" : 0 } '{"acknowledged":true}

3- 执行下面语句查看集群状态:索引

curl localhost:9200/_cluster/health?pretty

别急,此时确定仍是red状态,由于通常red状态是由于有主分片没有被分配 io

4-  使用下面语句查看未分配分片class

GET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason

发现有未分配主分片,个人解决方案是,在确认该索引能够删除的状况下,直接删除索引集群

5- 删除主分片未分配索引权限

curl -XDELETE localhost:9200/***

6- 确认是否还有未分配主分片grep

curl -XGET localhost:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED

7- 查看集群状态,此时,若是6结果为空,则状态为green或者yellow

8- 可是稍后重建索引以后,发现集群状态又变为red

9- 查看未分配主分片缘由:

curl -XGET localhost:9200/_cluster/allocation/explain?pretty

缘由发现是索引往节点挂载的data目录写操做时,出现accessdenied拒绝;

解决方式:chmod -R 777 data

修改data目录操做权限,再次删除上述索引,后集群状态正常; 

相关文章
相关标签/搜索