具体报错信息:

[2020-07-29T13:00:20,179][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"ccs-prd-01-2020.07.29", :_type=>"_doc", :routing=>nil}, #], :response=>{"index"=>{"_index"=>"ccs-prd-01-2020.07.29", "_type"=>"_doc", "_id"=>nil, "status"=>400, "error"=>{"type"=>"validation_exception", "reason"=>"Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [2999]/[3000] maximum shards open;"}}}}

 

环境:

Es集群版本:7.1.1

节点数量:3

问题分析:

Elastaticsearch 7 版本以上,默认只允许1000个分片,所以问题是因为集群分片数不足引起的。


解决办法:

  1. 修改elastaticsearch.yml配置文件:
    
    增加一个配置参数:
    
    cluster.max_shards_per_node:5000 不建议分片数太多,如果实在过多可以适当减少单个索引的分片数量。 (这个我修改了重启后没有效果。)
  2. URL方式:
    [root@es /]# curl -u admin:xxxxxxxxx -XPUT -H "Content-Type:application/json" http://192.168.10.15:9200/_cluster/settings -d '{"transient":{"cluster":{"max_shards_per_node":10000}}}' 
    ###这是返回的结果 {"acknowledged":true,"persistent":{},"transient":{"cluster":{"max_shards_per_node":"10000"}}} 
    [root@es /]# 
    (实测可用执行完马上就好了不需要重启)

     

  3. 在Kibana tools中修改 :

 

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

 

打赏
分类: 文档

0 条评论

发表回复

Avatar placeholder