Logstash写入Elasticsearch并发问题

              公司项目是通过Logstash采集日志存入Elasticsearch集群中,Logstash通过配置文件启动的时候报如下错误:

   

[2017-03-11T10:08:11,390][ERROR][Logstash.outputs.elasticsearch] Action
[2017-03-11T10:08:11,391][ERROR][Logstash.outputs.elasticsearch] Action
[2017-03-11T10:08:11,393][INFO][logstash.outputs.elasticsearch]retrying failed 
action with response code:429 ({"type" => "es_rejected_execution_exception", "reason" => "rejected" execute of [email protected] on EsThreadPoolExecutor [bulk.queue.capacity=50, [email protected]e35f2 [Runing, pool size = 32, active threads = 32 queue.capacity=50, completed tasks=1041050369"]}

      以为是资源不够,通过停了所有Logstash进程再重新启动,同样报这个错误。确认不是集群资源问题。通过设置elasticsearch.yml设置纯种池也无法解决问题:

    

  1. threadpool.index.type: fixed  
  2. threadpool.index.size: 100  
  3. threadpool.index.queue_size: 500 

 

线程处理不过来。queue加大到1000也无法解决这个问题。

 

       通过RestAPIs:http://localhost:9002/_cat/thread_pool?pretty查看其拒绝服务的那台机器,正好是分片数量最多的节点。也就是分片没有打散,当前集中有3个分片,导致请求压力都在当前节点上。通过设置模版和索引的index.routing.allocation.total_shards_per_node属性解决这个问题。设置成功后分片会打散至其他节点上。 

        需要特别注意这个属性,如果设置值为1,也就是说每个节点最多保存一个分片,当你分片的总数(包括复本数)大于节点数,会一值报分片的异常。


Logstash写入Elasticsearch并发问题
   

 

   

 

 

 

相关文章:

  • 2021-07-17
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-07-20
  • 2021-04-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2022-12-23
  • 2021-04-26
  • 2021-09-14
  • 2021-07-19
相关资源
相似解决方案