Flume实战案例二,监听一个文件实时采集新增的数据输出到控制台

 

Agent选型:exec source +memory channel +logger sink

看http://flume.apache.org/FlumeUserGuide.html#exec-source有相应的介绍

Flume实战案例二,监听一个文件实时采集新增的数据输出到控制台_第1张图片

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

# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command=tail -F /usr/soft/data.log
a1.sources.r1.shell=/bin/sh -c

# Describe the sink
a1.sinks.k1.type = logger

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

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

启动命令:

flume-ng agent --name a1 --conf $FLUME_HOME/conf  --conf-file $FLUME_HOME/conf/exec-memory-logger.conf -Dflume.root.logger=INFO,console

 

 

 

 

 

 

你可能感兴趣的:(Flume)