`
aishu
  • 浏览: 23003 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Logstash写入Elasticsearch并发问题

阅读更多

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 org.elasticsearch.transport.TransportService$6@1046foc on EsThreadPoolExecutor [bulk.queue.capacity=50, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@e2e35f2 [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,也就是说每个节点最多保存一个分片,当你分片的总数(包括复本数)大于节点数,会一值报分片的异常。



   

 

   

 

 

 

  • 大小: 66.9 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics