1.新建配置文件flumejob_telnet.conf
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
a1.sinks.k1.type = logger
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
2.上传到/opt/module/flume/conf
3.启动命令:
bin/flume-ng agent --conf conf/ --name a1 --conf-file conf/flumejob_telnet.conf -Dflume.root.logger=INFO,console
bin/flume-ng agent //使用ng启动agent
--conf conf/ //指定配置所在文件夹
--name a1 //指定agent别买
--conf-file conf/flumejob_telnet.conf //指定配置文件
-Dflume.root.logger=INFO,console //指定日志级别
4.测试
(1).下载telnet:往端口内发送数据(netcat也可以)
yum install nc
yum search telnet
yum install telnet.x86_64
(2).开启telnet工具,输入信息
telnet localhost 444444 //开启
11
22
33
are you ok //输入信息
(3).查看监控