什么原因导致了使用GCS接收器的水槽抛出OutOfMemoryException
我正在使用flume写入Google Cloud Storage。 Flume在HTTP:9000
上收听。我花了一些时间使它工作(添加gcs库,使用凭证文件...),但现在它似乎通过网络进行通信。什么原因导致了使用GCS接收器的水槽抛出OutOfMemoryException
我送非常小的HTTP请求我的考验,我有足够的可用RAM:
curl -X POST -d '[{ "headers" : { timestamp=1417444588182, env=dev, tenant=myTenant, type=myType }, "body" : "some body ONE" }]' localhost:9000
我遇到的第一个请求这个内存异常(那当然,它停止工作):
2014-11-28 16:59:47,748 (hdfs-hdfs_sink-call-runner-0) [INFO - com.google.cloud.hadoop.util.LogUtil.info(LogUtil.java:142)] GHFS version: 1.3.0-hadoop2
2014-11-28 16:59:50,014 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:467)] process failed
java.lang.OutOfMemoryError: Java heap space
at java.io.BufferedOutputStream.<init>(BufferedOutputStream.java:76)
at com.google.cloud.hadoop.fs.gcs.GoogleHadoopOutputStream.<init>(GoogleHadoopOutputStream.java:79)
at com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystemBase.create(GoogleHadoopFileSystemBase.java:820)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:906)
(见complete stack trace as a gist的全部细节)
奇怪的是,文件夹和文件被创建的方式我想,但文件是空的。
gs://my_bucket/dev/myTenant/myType/2014-12-01/14-36-28.1417445234193.json.tmp
是不是有毛病我配置水槽+ GCS还是在GCS.jar一个错误的方式?
我应该在哪里检查以收集更多数据?
ps:我在docker里面运行flume-ng。
我flume.conf
文件:
# Name the components on this agent
a1.sources = http
a1.sinks = hdfs_sink
a1.channels = mem
# Describe/configure the source
a1.sources.http.type = org.apache.flume.source.http.HTTPSource
a1.sources.http.port = 9000
# Describe the sink
a1.sinks.hdfs_sink.type = hdfs
a1.sinks.hdfs_sink.hdfs.path = gs://my_bucket/%{env}/%{tenant}/%{type}/%Y-%m-%d
a1.sinks.hdfs_sink.hdfs.filePrefix = %H-%M-%S
a1.sinks.hdfs_sink.hdfs.fileSuffix = .json
a1.sinks.hdfs_sink.hdfs.round = true
a1.sinks.hdfs_sink.hdfs.roundValue = 10
a1.sinks.hdfs_sink.hdfs.roundUnit = minute
# Use a channel which buffers events in memory
a1.channels.mem.type = memory
a1.channels.mem.capacity = 10000
a1.channels.mem.transactionCapacity = 1000
# Bind the source and sink to the channel
a1.sources.http.channels = mem
a1.sinks.hdfs_sink.channel = mem
在我的水槽/ GCS旅程
相关的问题:What is the minimal setup needed to write to HDFS/GS on Google Cloud Storage with flume?
在上传文件时,GCS的Hadoop文件系统实现留出了相当大的( 64MB)每个FSDataOutputStream写入缓冲区(文件打开写入)。这可以通过在core-site.xml中将"fs.gs.io.buffersize.write"设置为更小的值(以字节为单位)来更改。我想1MB就足够用于低容量的日志收集。
另外,检查启动JVM for flume时最大堆大小的设置。 flume-ng脚本将默认的JAVA_OPTS值设置为-Xmx20m,以将堆限制为20MB。这可以在flume-env.sh中设置为更大的值(有关详细信息,请参阅flume tarball分发中的conf/flume-env.sh.template)。
太糟糕了,我们无法将JVM大小传递给flume-ng – 2014-12-02 15:13:50