flume对接kafka时延迟和高吞吐量以及flume筛选日志


 以下是我的flume配置文件,实现了低延迟,筛选功能

# 命名
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# sources配置
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /root/flume.log
a1.sources.r1.batchSize=1
#a1.sources.r1.type= spooldir
#a1.sources.r1.spoolDir= /opt/flume

# sinks配置
#a1.sinks.k1.type = avro
#a1.sinks.k1.hostname = 172.21.16.46
#a1.sinks.k1.port =44445

a1.sinks.k1.type= org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.brokerList=172.21.16.26:9092
a1.sinks.k1.topic=test22

#一次处理的数据条数 bathsize越高,处理的数据越多,延迟越高
#a1.sinks.k1.serializer.class=kafka.serializer.StringEncoder
a1.sinks.k1.requiredAcks = 1
a1.sinks.k1.batchSize = 1

#filter可以进行筛选日志
#a1.sources.r1.interceptors=i1
#a1.sources.r1.interceptors.i1.type=regex_filter
#a1.sources.r1.interceptors.i1.regex=(helloword)(.*)


# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000000
a1.channels.c1.transactionCapacity = 1000000

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

猜你喜欢

转载自blog.csdn.net/xiaolong_4_2/article/details/82493105