Elasticsearch 集群运行状况间歇性地在 'GREEN' 和 'YELLOW' 之间波动

Elasticsearch cluster health intermittently flaps between 'GREEN' and 'YELLOW'

我们是 运行 具有 "ZERO" 个副本的 7 节点集群,如下所示:

{
"cluster_name": "my_cluster",
"status": "green",
"timed_out": false,
"number_of_nodes": 7,
"number_of_data_nodes": 7,
"active_primary_shards": 3325,
"active_shards": 3325,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100.0
}

elasticsearch 集群状态间歇性地从 "Green" 变为 "Yellow"。我注意到的另一件有趣的事情是在这个间歇性的集群状态变化期间,发生了分片初始化,这与集群状态变化相关。这是由于集群 运行 "ZERO" 副本造成的吗? 什么可能导致上述行为?

1.find 索引为

http://IP_MASTER:9200/_cat/indices?v 

2.find 具有该索引分片的节点正在分配和取消分配。

http://IP_MASTER:9200/_cat/shards?v
  1. 在该节点上重新启动服务 elasticsearch
  2. 如果存在问题,您有两个选择。

一个。 lucene 检查索引(只检查那个分片)

java -cp lucene-core*.jar -ea:org.apache.lucene… org.apache.lucene.index.CheckIndex /mnt/nas/elasticsearch/graylog-production/nodes/0/indices/graylog_92/0/index/ -verbose -exorcise

如果它说找不到该段,请尝试在该路径上查找并 cd 并 运行 命令。

乙。 elasticsearch 修复索引(它检查所有索引并且非常慢)

index.shard.check_on_startup: fix

您应该在该节点的 elasticsearch.yml 上设置此配置。