admin管理员组

文章数量:1582020

ES集群状态、节点、索引及基本查询

一、elasticsearch 索引 red 状态恢复 green

错误原因

由于CPU占用过高或者有部分节点的分片不可用,未被分配;

解决:

  1. 重新分配未被分配的分片;允许恢复的时候有一定的数据损失,以此方式解决;

  2. 新增一个节点以便于重新进行分片分配;

查看节点的分配情况:
http://172.xxx.xxx.8:9200/_cat/shards

找到某个节点id:
http://172.xxx.xxx.8:9200/_nodes/process

重新分配:
curl -X POST -d '{
    "commands" : [ {
      "allocate" : {
          "index" : "index",
          "shard" : 1,
          "node" : "EafIS3ByRrm4g-14KmY_wg",
          "allow_primary" : true
      }
    }]
}' "http://172.xxx.xxx.8:9200/_cluster/reroute"

执行会报错,以下方式恢复正常
{
  "commands": [
    {
      "allocate_empty_primary": {
         "index" : "idx_tile",
          "shard" : 1,
          "node" : "Qy9c1mQvRkqrBmqvZQ8m8g",
          "accept_data_loss":true
      }
    }
  ]
}

参考博客链接

参考:

  • https://wwwblogs/Neeo/articles/10578456.html
  • https://blog.csdn/qq_43341418/article/details/103405834

本文标签: 索引状态ElasticsearchGreenRed