0
点赞
收藏
分享

微信扫一扫

flume采集端口数据

扬帆远航_df7c 2022-05-04 阅读 44

关于端口:需要下载telnet与xinetd可以看这个文章

(28条消息) CentOS7.6 开启 Telnet 服务_Showay518的博客-CSDN博客

先通过yum list |grep telnet | xinetd | telnet-server 查看版本,通过yum install 安装服务

启动这些服务

  • systemctl start telnet.socket
  • systemctl start xinetd.service

通过status查看服务状态

测试telnet连接(telnet默认23端口号):

  • telnet localhost         // telnet 客户端连接主机服务器(localhost)

centos默认不允许root登录,若要root登录 则需要在/etc/surectty中追加pts/1 2 3 4;即可使用telnet登录。

我的flume采集代码

a1.sources = r1
a1.channels = c1
a1.sinks = k1
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

#配置source
a1.sources.r1.type = netcat
a1.sources.r1.bind = 192.168.60.131
a1.sources.r1.port = 4444

#配置channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 1000

#配置sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://master:50070/target_path
a1.sinks.k1.fileprefix = flume
a1.sinks.k1.filesufix = data
a1.sinks.k1.round = true
a1.sinks.k1.hdfs.value = 10
a1.sinks.ka.hdfs.unit = 10

将端口数据采集到hdfs上

使用 telnet 192.168.60.131 4444 ,即实时采集端口数据到hdfs上

注意:

  • 在这里必须先启动flume(bin/flume-ng agent --conf conf/ --name a1 --conf-file jobs/connectPort_to_kafka.conf -Dflume.root.logger=INFO,console)
  • 再启动telnet 192.168.60.131 4444

 否则会报错:地址正在使用

 

举报

相关推荐

0 条评论