Elasticsearch 错误 - 集群健康状态从 [YELLOW] 更改为 [RED](原因:[shards failed

Elasticsearch Error - Cluster health status changed from [YELLOW] to [RED] (reason: [shards failed

我正在使用 elasticdump 通过以下命令将庞大的数据集转储到弹性搜索节点中:elasticdump --input=./xyz.json --output=http://localhost:9200/。一切正常,但一段时间后我在控制台中看到这些错误消息:

_type: 'doc',
_id: 'lzHMQmUBQ1VCv6VBROQA',
status: 503,
error:
{ type: 'unavailable_shards_exception',
 reason: '[logstash-2018.08.16][2] primary shard is not active Timeout: 
[1m], request: [BulkShardRequest [[logstash-2018.08.16][2]] containing [31] requests]' } }

在检查 elasticsearch 日志时,可以看到以下错误:

[2018-08-31T11:27:21,496][INFO ][o.e.c.r.a.AllocationService] [dqSwClD] Cluster health status changed from [YELLOW] to [RED] (reason: [shards failed [[logstash-2018.08.16][2]] ...]).

我不确定是什么原因导致了 shard failure 并且一些故障排除工作被证明是失败的。

您可以在 https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-indexing-speed.html 找到很多优化批量索引的技巧:

  • 禁用副本
  • 禁用几乎实时刷新(refresh_interval 索引)
  • 等...