a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource
a1.sources.r1.kafka.bootstrap.servers = cdh-10-10-1-70.vm.crypto.lan:9092,cdh-10-10-1-71.vm.crypto.lan:9092,cdh-10-10-1-72.vm.crypto.lan:9092
a1.sources.r1.kafka.topics=transactions
# 调整这个参数性能提升很大,默认最大10000
a1.sources.r1.batchSize=10000
a1.sources.r1.batchDurationMillis=2000
# 这个参数第一次使用的时候才有效,默认lastest,这个参数很重要,一定要配,不然换消费者了也还是消费最近的而不是最早的
a1.sources.r1.kafka.consumer.auto.offset.reset = earliest
a1.sources.r1.kafka.consumer.group.id=trans2
# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://cdh-10-10-1-70.vm.crypto.lan:8020/flume/transactions/%Y%m%d/
#上传文件的前缀
a1.sinks.k1.hdfs.filePrefix = transactions-
#是否按照时间滚动文件夹
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.roundValue = 1
#重新定义时间单位
a1.sinks.k1.hdfs.roundUnit = hour
#是否使用本地时间戳
a1.sinks.k1.hdfs.useLocalTimeStamp = true
#积攒多少个Event才flush到HDFS一次
a1.sinks.k1.hdfs.batchSize = 100
#设置文件类型,可支持压缩
a1.sinks.k1.hdfs.fileType = DataStream
#多久生成一个新的文件
a1.sinks.k1.hdfs.rollInterval = 3600
#设置每个文件的滚动大小大概是128M
a1.sinks.k1.hdfs.rollSize = 134217700
#文件的滚动与Event数量无关
a1.sinks.k1.hdfs.rollCount = 0
# Use a channel which buffers events in memory
a1.channels = c1
a1.channels.c1.type = file
a1.channels.c1.checkpointDir = /opt/flume/checkpoint
a1.channels.c1.dataDirs = /opt/flume/data1,/opt/flume/data2
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1