1) Exec
- 创建agent配置文件
# > vi /home/bigdata/flume/conf/exec_tail.conf
添加以下内容:
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/log_exec_tail
# 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 agent a1
- # > flume-ng agent -c . -f /home/bigdata/flume/conf/exec_tail.conf -n a1 -Dflume.root.logger=INFO,console
- 制作log_exec_tail文件
# > echo "exec tail 1" >> /home/data/log_exec_tail
- 在master的控制台,可以看到以下信息:
- 向log_exec_tail文件中追加数据
# > echo "exec tail 2" >> /hadoop/flume/log_exec_tail
- 在master的控制台,可以看到以下信息:
# for i in {1..100}
> do echo "flume +" $i >> /home/data/log_exec_tail
> done