Flume HDFS Sink generates lots of tiny files on HDFS

后端 未结 3 1268
北恋
北恋 2021-01-24 18:14

I have a toy setup sending log4j messages to hdfs using flume. I\'m not able to configure the hdfs sink to avoid many small files. I thought I could configure the hdfs sink to

3条回答
  •  不要未来只要你来
    2021-01-24 18:40

    It is your typo in conf.

    #sink config
    a1.sinks.i1.type=hdfs
    a1.sinks.i1.hdfs.path=hdfs://localhost:8020/user/myName/flume/events
    #never roll-based on time
    a1.sinks.i1.hdfs.rollInterval=0
    #10MB=10485760
    a1.sinks.il.hdfs.rollSize=10485760
    #never roll base on number of events
    a1.sinks.il.hdfs.rollCount=0
    

    where in the line 'rollSize' and 'rollCount', you put il as i1. Please try to use DEBUG, then you will find like:

    [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.sink.hdfs.BucketWriter.shouldRotate:465)  - rolling: rollSize: 1024, bytes: 1024
    

    Due to il, default value of rollSize 1024 is being used .

提交回复
热议问题