Source AVRO
AVRO Source会监听指定的端口,接收其他节点传过来的被AVRO序列化之后的数据。AVRO Source结合AVRO Sink可以实现更多的流动模型/拓扑结构,例如多级流动、扇入流动、扇出流动等。
实例代码
vim avrosource.conf
a1.sources = s1
a1.channels = c1
a1.sinks = k1
a1.sources.s1.type = avro
a1.sources.s1.bind = m1
a1.sources.s1.port = 10000
a1.channels.c1.type = memory
a1.sinks.ke.type = logger
a1.sources.s1.channels = c1
a1.sinks.k1.channel = c1
注意bind要填写主机名或ip
启动flume
flume-ng agent -c $FLUME_HOME/conf -n a1 -f $FLUME_HOME/avrosource.conf -Dflume.root.logger=INFO,console
在另一个目录中编辑一个文件
vim test.txt aaaaa
发送文件test.txt数据序列化给flume,指定主机名m1,端口号4141,文件名test.txt
flume-ng avro-client -c -c $FLUME_HOME/conf/ -H m1 -p 4141 -F test.txt
查看日志文件
tail -f flume.log