串联的Agent中间采用Avro Sink和 Avro Source方式进行数据传输
1. Hadoop02配置文件a.conf
采集Hadoop02文件,传输到Hadoop02
# 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 = cat /home/hadoop/second.txt
# Describe the sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = hadoop04
a1.sinks.k1.port = 44444
# 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
2. Hadoop04配置文件b.conf
采集Hadoop04文件,传输到hdfs
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = avro
a1.sources.r1.bind = hadoop04
a1.sources.r1.port = 44444
# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = /a/flume/test_01
# 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
3. 启动Hadoop04上的Agent
flume-ng agent --conf conf --conf-file /home/hadoop/kylin/b.conf --name a1
4. 启动Hadoop02上的Agent
flume-ng agent --conf conf --conf-file /home/hadoop/kylin/a.conf --name a1