切记,在进行flume监测文件时采用的是正则表达式

# Name the components on this agent
a1.sources = r1
a1.channels = c1 c2
a1.sinks = k1 k2

#将数据流复制给所有channel
#下边这句是默认的,不配置也可以
#a1.sources.r1.selector.type = replicating

#source
a1.sources.r1.type = TAILDIR
a1.sources.r1.positionFile = /opt/module/flume/taildir_position.json
a1.sources.r1.filegroups = f1
a1.sources.r1.filegroups.f1 = /opt/module/flume/test/.\*.log

#此处若只写.log那么肯定不行啊,这样就只监测文件名称为.log的文件而不是后缀为.log的文件,若想监测后缀为.log的文件那么采用上边标红的正则表达式,小伙子,去练练正则也可以哈

#channel

a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 10000

a1.channels.c2.type = memory
a1.channels.c2.capacity = 10000
a1.channels.c2.transactionCapacity = 10000


#sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = hadoop103
a1.sinks.k1.port = 4141

a1.sinks.k2.type = avro
a1.sinks.k2.hostname = hadoop104
a1.sinks.k2.port = 4142

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

相关推荐