Elasticsearch 超出分片1000,无法写入

现象: es 日志出现:

[2021-12-15T07:45:10,517][WARN ][o.e.x.m.e.l.LocalExporter] [node-1] unexpected error while indexing monitoring document
org.elasticsearch.xpack.monitoring.exporter.ExportException: org.elasticsearch.common.ValidationException: Validation Failed: 1: this action would add [1] total shards, but this cluster currently has [1053]/[1000] maximum shards open;

显示分片打开超过1000 的分片

分析: Elasticsearch 7.x 默认 cluster.max_shards_per_node 为 1000

操作:

调整分片为每个节点的分片为10000

#通过API 进行修改

PUT /_cluster/settings
    {
      "persistent": {
        "cluster": {
          "max_shards_per_node":10000
        }
      }
    }

transient 临时
persistent 永久

总结:

        对于一些ES 只有一台主机,最好开始根据业务情况进行调整每个节点的分片数。在配置文件配置为

cluster.max_shards_per_node: 10000  

启动后验证一下:

GET /_cluster/settings

操作后都需要验证一下。

你可能感兴趣的:(es,elasticsearch,搜索引擎,big,data)