我们线上项目的新闻搜索用的是es的搜索引擎,这两天突然发现一些新闻搜不到了,登上es的head插件页面看了一眼发现

   ES 集群不健康red解决办法

集群不健康了,百度谷歌水军了一番,终于找到解决方案:

1.查看集群的健康状态:

curl -XGET 'http://localhost:9200/_cluster/health?pretty'

ES 集群不健康red解决办法

看到集群的状态是红色的

2.查看集群的整体情况

curl -XGET 'http://localhost:9200/_nodes/stats?pretty'

ES 集群不健康red解决办法

注意红框内的集群的id,下面脚本要用

3.重新分配节点

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
        "commands" : [ {
              "allocate" : {
                  "index" : "xxxx",
                  "shard" : 3,
                  "node" : "mHbd9k9bT_e06OieycC84A",
                  "allow_primary" : true
              }
            }
        ]

    }'

其中index:索引的名字

       shard:head中还存在的节点

       node:就是刚才红框中的id

运行成功,查看head中的节点信息,正常使用

相关文章:

  • 2021-04-11
  • 2021-11-22
  • 2021-11-11
  • 2021-10-29
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-10-31
  • 2018-08-07
  • 2021-10-18
相关资源
相似解决方案