Netcat使用及Flume数据采集

netcat

nc 服务端 (在本地的44444开启服务端)

nc -lk localhost 44444

如果提示端口已存在,则查到进程并杀死

netstat -anp | grep 44444

kill -9 537077

nc 客户端(以客户端身份连接至44444端口)

nc localhost 44444

如果客户端指令输入后,没有报错也没有陷入阻塞,那么是没有检测到服务端

Flume 采集

flume 相当于开启了nc的一个服务端,监听所有客户端的信息

vim NetCatSource.conf 
a1.sources = s1
a1.channels = c1
a1.sinks = k1

a1.sources.s1.channels = c1
a1.sources.s1.type = netcat
a1.sources.s1.bind = localhost
a1.sources.s1.port = 10000

a1.channels.c1.type = memory
a1.channels.c1.capacity = 100

a1.sinks.k1.channel = c1
a1.sinks.k1.type = logger
flume-ng agent -n a1 -c conf -f NetCatSource.conf -Dflume.root.logger=INFO,console
nc localhost 10000
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容