Netcat使用及Flume数据采集

2022-10-31  本文已影响0人  会爬虫的小蟒蛇

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
上一篇 下一篇

猜你喜欢

热点阅读