ES 常见错误
报错 maximum shards open
问题描述
创建索引时,报错显示this action would add [2] total shards, but this cluster currently has [1000]/[1000] maximum shards open。
查看分片数量
GET /_cluster/settings?filter_path=transient.cluster.max_shards_per_node,persistent.cluste.max_shards_per_node
{
"transient" : {
"cluster" : {
"max_shards_per_node" : "1000"
}
}
}
问题原因
由于节点shard数量超过最大值限制,ES默认每个节点的shard数量是1000,如果shard数量超过这个值创建索引会报错。
解决方案
关闭或者删除不用的索引,减少shard数量。
修改节点的shard数量的限制,这里设置 3000。
PUT _cluster/settings { "persistent": { "cluster": { "max_shards_per_node": 2000 } } }
或者
curl -X PUT localhost:9200/_cluster/settings -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "3000" } }'
文章参考
CSS创建索引报错maximum shards open_云搜索服务 CSS_故障排除_功能使用类 (huaweicloud.com)
报错 org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
问题表述描述


如何处理
curl -X GET "http://localhost:9200/_cat/indices/.kibana_task_manager?v" # 检查 .kibana_task_manager索引状态和健康状况
curl -X GET "http://localhost:9200/_cluster/health?pretty" # 确保索引状态为 open,并检查其健康状态
curl -X POST "http://localhost:9200/.kibana_task_manager/_refresh" # 刷新索引
curl -X GET "http://localhost:9200/_cat/shards/.kibana_task_manager?v" # 检查分片状态

如果问题持续,考虑删除并重建索引, UI中,重新创建索引
Last updated