首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

大数据进级教程之-Flume监听netstat端口

一、安装 netcat 工具

[root@hadoop-master myproject]# sudo yum install -y nc

二、判断 66666端口是否被占用

[root@hadoop-master myproject]# netstat -nlp | grep 66666

三、创建 Flume Agent 配置文件

进入Flume安装目录创建文件夹job,添加配置文件

[root@hadoop-master flink-local]# mkdir job[root@hadoop-master conf]# touch flume-netcat-logger.conf

flume-netcat-logger.conf内容如下:

添加内容如下:# Name the components on this agenta1.sources = r1a1.sinks = k1a1.channels = c1# Describe/configure the sourcea1.sources.r1.type = netcata1.sources.r1.bind = 192.168.0.129a1.sources.r1.port = 66666# Describe the sinka1.sinks.k1.type = logger# Use a channel which buffers events in memorya1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100# Bind the source and sink to the channela1.sources.r1.channels = c1a1.sinks.k1.channel = c1

r1:表示a1的Source的名称

k1:表示a1的Sink的名称

c1:表示a1的Channel的名称

四、先开启 flume 监听端口

[root@hadoop-master bin]# ./flume-ng agent -n a1 -c conf/ -f ../job/flume-netcat-logger.conf -Dflume.root.logger=INFO,console

参数说明:

--conf/-c:表示配置文件存储在 conf/目录

--name/-n:表示给 agent 起名为 a1

--conf-file/-f:flume 本次启动读取的配置文件是在 job 文件夹下的 flume-telnet.conf

文件。

参数属性值,并将控制台日志打印级别设置为 INFO 级别。日志级别包括:log、info、warn、error。

五、使用 netcat 工具向本机的 44444 端口发送内容

[root@hadoop-master ~]# nc 192.168.0.129 44444

接收日志:

下一节我们进行flume对HDFS的实例演示,感谢继续关注

  • 发表于:
  • 原文链接https://page.om.qq.com/page/OyeG7BVzvgW8iH6SglSNTNbQ0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券
http://www.vxiaotou.com