elasticsearch 索引 red 状态恢复 green

    技术2023-06-11  95

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

    一、elasticsearch 索引 red 状态恢复 green

    错误原因

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

    解决:

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

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

    查看节点的分配情况: 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://www.cnblogs.com/Neeo/articles/10578456.htmlhttps://blog.csdn.net/qq_43341418/article/details/103405834
    Processed: 0.014, SQL: 9