使用流利和水槽无限增加的文件描述符数量

时间:2017-08-16 15:00:31

标签: docker flume fluent

我在Docker容器中使用fluent-plugin-flume运行流畅的代理。 一段时间后,我的容器内的某些程序因下一个错误而失败:

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 config:

<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 config:

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

有没有办法限制文件描述符号码?

1 个答案:

答案 0 :(得分:1)

尝试在源文件中添加'threads'到你的flume配置。 像这样:

forward_1.sources.source1.threads = number_of_threads

详细了解https://flume.apache.org/FlumeUserGuide.html#thrift-source