Flume案例实战二
需求:监控一个文件实时采集新增的数据输出到控制台
[hadoop000@hadoop000 data]$ touch data.log
[hadoop000@hadoop000 data]$ cat data.log
[hadoop000@hadoop000 data]$ pwd
/home/hadoop000/data
创建 exec-memory-logger.conf文件:
#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 /home/data/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
#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