NetCat Source分为NetCat TCP Source和NetCat UDP Source,都是用于监听指定的主机和端口,从该端口接收TCP请求或者UDP请求的数据。
可配项
如果需要发送TCP请求,使用nc命令;如果需要发送UDP请求,使用nc -u命令。
NetCat TCP Source
参考flume (二)安装-CSDN博客,中的例子
NetCat UDP Source
vim udpsource.conf
a1.sources = s1
a1.channels = c1
a1.sinks = k1
a1.sources.s1.type = netcatudp
a1.sources.s1.bind = 0.0.0.0
a1.sources.s1.port = 6666
a1.sources.s1.channels =c1
a1.sinks.k1.type = logger
a1.sinks.k1.channel = c1
a1.channels.c1.type = memory
启动
flume-ng agent -c $FLUME_HOME/conf -n a1 -f $FLUME_HOME/udpsource.conf -Dflume.root.logger=INFO,console
发送数据 nc -u 127.0.0.1 6666