使用 fluent 和 flume 无限增加的文件描述符数量

Number of file descriptors increasing infinitely using fluent and flume

我 运行 带有流利插件的流利代理 - flume 在 Docker 容器内。 一段时间后,我的容器中的一些程序失败并出现下一个错误:

Check failed: _s.ok() Bad status: Runtime error: Could not create thread: Resource temporarily unavailable (error 11)

我发现 Docker 容器内的文件描述符数量无限增加:

sudo lsof| grep flume | wc -l
469292

一段时间后,描述符的数量变得大于文件描述符的限制。 看起来 thrift 连接的处理方式有误:文件描述符在事务结束后仍然存在。

Fluend 配置:

<source>
  @type forward
  tag forward_1
  bind 0.0.0.0
  port 24224
  linger_timeout 0
</source>

<match forward_1>
      @type copy
      <store>
              @type flume
              timeout 15
              host localhost
             port 33333
      </store>
</match>

Fume 配置:

forward_1.sources  = source1
forward_1.channels = channel1
forward_1.sinks = sink1
#
forward_1.sources.source1.type = thrift
forward_1.sources.source1.bind = localhost
forward_1.sources.source1.port = 33333
forward_1.sources.source1.channels = channel1
#
forward_1.channels.channel1.type = memory
forward_1.channels.channel1.capacity = 10000
forward_1.channels.channel1.transactionCapacity = 1000
#
forward_1.sinks.sink1.type = org.apache.kudu.flume.sink.KuduSink
forward_1.sinks.sink1.channel = channel1
forward_1.sinks.sink1.masterAddresses = 10.1.0.1:7051
forward_1.sinks.sink1.tableName = shop_logs
forward_1.sinks.sink1.batchSize = 50
forward_1.sinks.sink1.producer = KuduJsonProducer

Docker 版本:17.03 流利的版本:0.14.19 Flume版本:1.7.0

有没有办法限制文件描述符的数量?

尝试将 'threads' in sources 添加到您的 flume 配置中。 像这样:

forward_1.sources.source1.threads = number_of_threads

阅读更多关于https://flume.apache.org/FlumeUserGuide.html#thrift-source