shard_limit_exceeded elasticsearch resource_error ai_generated partial

ElasticsearchException:创建索引 [logs-2025.03] 失败 - 此操作将增加 [2] 个分片,但集群当前已有 [1000]/[1000] 个最大打开分片

ElasticsearchException: failed to create index [logs-2025.03] - this action would add [2] shards, but this cluster currently has [1000]/[1000] maximum shards open

ID: elasticsearch/shard-limit-exceeded-for-node

其他格式: JSON · Markdown 中文 · English
78%修复率
85%置信度
1证据数
2024-06-15首次发现

版本兼容性

版本状态引入弃用备注
Elasticsearch 7.17.0 active — — —
Elasticsearch 8.11.0 active — — —
Elasticsearch 8.15.0 active — — —

根因分析

集群已达到允许的最大分片数,无法创建新索引。

English

The cluster has reached the maximum number of shards allowed, preventing the creation of new indices.

generic

官方文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/misc-cluster-settings.html#cluster-max-shards-per-node

解决方案

  1. Reduce the number of shards per index by reindexing with fewer primary shards. For example, use `POST /_reindex` with a target index that has 1 primary shard instead of 5: `{"source": {"index": "logs-2025.03"}, "dest": {"index": "logs-2025.03-compact", "number_of_shards": 1}}`
  2. Increase `cluster.max_shards_per_node` cautiously after auditing shard distribution. Run `GET _cluster/settings` to check current limit, then set via `PUT _cluster/settings` with `{"persistent": {"cluster.max_shards_per_node": 1500}}`. Ensure enough heap per node.

无效尝试

常见但无效的做法:

  1. 70% 失败

    This only delays the problem and can cause severe performance degradation because each node handles too many shards, leading to heap pressure and slow recovery.

  2. 45% 失败

    Deleting indices may not free up shard slots if the cluster-level limit is still hit due to node distribution; also risks data loss.