Press "Enter" to skip to content

ELK日志集群无法正常写入日志 (this cluster currently has [3000]/[3000] maximum normal shards open)

Validation Failed: 1: this action would add [2] shards, but this cluster currently has [3000]/[3000] maximum normal shards open;

背景:

早上同事告知我公司的ELK集群上面查不到今天的最新日志了

我自己去查了下,确实早上的日子就没有了,我们有3类日志,只少了其中一类,另外两类还还正常,很奇怪。

问题排查:

我发现出问题的日志类型对应的index没有正常创建,kibana的 stack monitoring也不能正常打开。

然后我查了各方面的日志,也没有什么异常日志输出。

我尝试手动的创建日志索引,

我在 /app/dev_tools 里面执行:

PUT log-logstash-2023.05.10

我得到一个错误:

Validation Failed: 1: this action would add [2] shards, but this cluster currently has [3000]/[3000] maximum normal shards open;

大概意思是,我这个动作会创建2个shard,但是这个集群目前已经有3000个了,满了!

去网上搜了下,大概意思是es的话每个节点默认最多只能有1000个shard,然后我的集群是3个节点,所以最多整个集群只能容纳3000个shard。

所以如果我是单节点的话,可能会出现类似:

but this cluster currently has [1000]/[1000] maximum shards open 

这样的错误。

解决方案:

可以通过配置来修改这个阶段shard的限制:

curl -X PUT localhost:9200/_cluster/settings -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "3000" } }'

这个命令是将节点限制改到3000。

而我的场景的话,可能需要清理下数据,因为我这边是日志系统,不需要存那么久的数据。

遂将最老的日志数据进行了清理,然后当日的index被正常创建,一切恢复如故。

参考资料:

https://stackoverflow.com/questions/62284168/cluster-has-already-maximum-shards-open

https://github.com/wazuh/wazuh-puppet/issues/222

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注