解决ElasticSearch的maximum shards o
2021-05-06 本文已影响0人
风静花犹落
问题:
ValidationException[Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;]
原因:
这是因为集群最大shard(分片)数不足引起的,从Elasticsearch v7.0 开始,集群中的每个节点默认限制1000个分片。
解决:
方案1、在elasticsearch.yml中定义
> cluster.max_shards_per_node: 10000
方案2、在kibana控制台执行:
PUT /_cluster/settings
{
"transient": {
"cluster": {
"max_shards_per_node":10000
}
}
}
方案3、在linux控制台执行:
curl -XPUT http://localhost:9200/_cluster/settings \
-u elastic:password \
-H "Content-Type: application/json" \
-d '{"transient":{"cluster":{"max_shards_per_node":10000}}}'
结果:
返回{"acknowledged":true,"persistent":{},"transient":{"cluster":{"max_shards_per_node":"10000"}}}
表示执行成功!