1、source,channel,sink的关系
首先要弄清楚flume架构里三者的关系。
# Bind the source and sink to the channel
a1.sources.r1.channels = c1 c2
a1.sinks.k1.channel = c1
a1.sinks.k2.channel = c2
如以上配置所示,source的绑定channel,参数是channels,因此source与channel是一对多的关系。
sink绑定channel,参数是channel,因此一个sink对应一个channel。
注意:一个channel可以有多个sink,但是一个sink只能来源于一个channel。
2、启动flume agent
bin/flume-ng agent -c conf/ -n a1 -f test.conf
# 如果需要将结果输出到控制台
# -Dflume.root.logger=INFO,console
bin/flume-ng agent --conf conf/ --name
a1 --conf-file test1.conf
-Dflume.root.logger=INFO,console