2016-08-24 2 views
0

Flume-ng를 사용하여 128MB의 로그 정보를 가져 와서 HDFS의 파일에 넣으려고합니다. 그러나 HDFS 롤링 옵션은 작동하지 않습니다. Flume-ng는 초당 로그 파일을 보냅니다. flume.conf 파일을 수정하려면 어떻게해야합니까?flume hdfs rollSize가 멀티 채널 및 멀티 싱크에서 작동하지 않습니다.

agent01.sources = avroGenSrc 
agent01.channels = memoryChannel hdfsChannel 
agent01.sinks = fileSink hadoopSink 

# For each one of the sources, the type is defined 
agent01.sources.avroGenSrc.type = avro 
agent01.sources.avroGenSrc.bind = dev-hadoop03.ncl 
agent01.sources.avroGenSrc.port = 3333 

# The channel can be defined as follows. 
agent01.sources.avroGenSrc.channels = memoryChannel hdfsChannel 

# Each sink's type must be defined 
agent01.sinks.fileSink.type = file_roll 
agent01.sinks.fileSink.sink.directory = /home1/irteam/flume/data 
agent01.sinks.fileSink.sink.rollInterval = 3600 
agent01.sinks.fileSink.sink.batchSize = 100 

#Specify the channel the sink should use 
agent01.sinks.fileSink.channel = memoryChannel 



agent01.sinks.hadoopSink.type = hdfs 
agent01.sinks.hadoopSink.hdfs.useLocalTimeStamp = true 
agent01.sinks.hadoopSink.hdfs.path = hdfs://dev-hadoop04.ncl:9000/user/hive/warehouse/raw_logs/year=%Y/month=%m/day=%d 
agent01.sinks.hadoopSink.hdfs.filePrefix = AccessLog.%Y-%m-%d.%Hh 
agent01.sinks.hadoopSink.hdfs.fileType = DataStream 
agent01.sinks.hadoopSink.hdfs.writeFormat = Text 
agent01.sinks.hadoopSink.hdfs.rollInterval = 0 
agent01.sinks.hadoopSink.hdfs.rollSize = 134217728 
agent01.sinks.hadoopSink.hdfs.rollCount = 0 

#Specify the channel the sink should use 
agent01.sinks.hadoopSink.channel = hdfsChannel 


# Each channel's type is defined. 
agent01.channels.memoryChannel.type = memory 
agent01.channels.hdfsChannel.type = memory 

# Other config values specific to each type of channel(sink or source) 
# can be defined as well 
# In this case, it specifies the capacity of the memory channel 
agent01.channels.memoryChannel.capacity = 100000 
agent01.channels.memoryChannel.transactionCapacity = 10000 

agent01.channels.hdfsChannel.capacity = 100000 
agent01.channels.hdfsChannel.transactionCapacity = 10000 

답변

0

이 해결책을 찾았습니다. dfs.replication mismatch로 인해이 문제가 발생합니다. 내 하둡의 conf에서

(hadoop-2.7.2/etc/hadoop/hdfs-site.xml)

<property> 
    <name>dfs.replication</name> 
    <value>3</value> 
</property> 

은 내가

<property> 
    <name>dfs.replication</name> 
    <value>2</value> 
</property> 

로 변경할 수 있도록 2 개 데이터 노드를하고 난 flume.conf

agent01.sinks.hadoopSink.hdfs.minBlockReplicas = 2 

감사에 대한에 설정을 추가

https://qnalist.com/questions/5015704/hit-max-consecutive-under-replication-rotations-error

Flume HDFS sink keeps rolling small files

관련 문제