Flume实战二,tail -F的方式监控一个文件实时采集新增的数据输出到控制台

在cd $FLUME_HOME/conf
vim exec-memory-logger.conf

#exec-memory-logger.conf内容
# a1可以看做是flume服务的名称,每个flume都由sources、channels和sinks三部分组成
# sources可以看做是数据源头、channels是中间转存的渠道、sinks是数据后面的去向
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# 配置Source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /data/a.txt
a1.sources.r1.shell = /bin/sh -c
#a1.sources.r1.command = for i in /path/*.txt; do cat $i; done

# 配置Channel
a1.channels.c1.type = memory

# 配置Sinks
a1.sinks.k1.type = logger

# Bind the source and sink to the channel 
#将指定source(r1)和channel(c1)绑定
#再将sink(k1)和channel(c1)绑定
#则:source(r1)和 sink(k1)已经连通
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1


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

猜你喜欢

转载自blog.csdn.net/u013429010/article/details/82788221