查看elk数据发现这两天没数据,查看了业务以后确定是elk采集出现了问题,经过查找logstash日志发现了有这个报错,如下:
Could not index event to Elasticsearch. {:status=>400, :action=>[“index”,…
“reason”=>”Validation Failed: 1: this action would add [2] shards, but this cluster currently has [1000]/[1000] maximum normal shards open;”}}}}
网上查找过是业务向ES请求创建索引时候报错,elasticsearch7.X开始,每个node默认分片1000个,以上报错是分片不足引起的;
找到 Elasticsearch 的配置文件/etc/elasticsearch/elasticsearch.yml在配置文件中找到 cluster.max_shards_per_node 参数。
如果找不到该参数,请在文件中的空白行处添加 以下行: cluster.max_shards_per_node: 4000 上述示例将 max_shards_per_node 设置为 4000,
您可以根据您的需求将其设置为所需的更大值。 保存并关闭配置文件。
重新启动 Elasticsearch 服务,以使更改生效。 注意:在对生产环境进行更改之前,请确保在进行任何更改之前进行充分的测试,并理解更改可能对集群性能和资源消耗产生的影响。
增加 max_shards_per_node 可能会增加集群的负载和资源消耗,因此需要仔细评估您的集群资源和性能需求。
重启以后查看日志没这样的报错了,查看数据应该有了。