美文网首页
解决ElasticSearch的maximum shards o

解决ElasticSearch的maximum shards o

作者: 风静花犹落 | 来源:发表于2021-05-06 19:56 被阅读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"}}}表示执行成功!

    相关文章

      网友评论

          本文标题:解决ElasticSearch的maximum shards o

          本文链接:https://www.haomeiwen.com/subject/eaoddltx.html