Flume 简单案例使用

版本 Flume 1.90 使用

配置文件信息

文件名nc-flume-log.cof

# 配置source sink 和channels 的命名
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# 配置 source 的属性
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# 配置shink的属性
a1.sinks.k1.type = logger

#  配置Channels 使用memory(内存)管理
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# 建立channels  source 和sink 的连接
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

在flume 目录下使用以下命令 可以启动flume

$ bin/flume-ng agent -n $agent_name -c conf -f conf/flume-conf.properties.template

$agent_name 是namen 就是简单案例中的a1

conf/flume-conf.properties.template 配置文件。就是编写的简单案例的文件

conf 指的是flume配置文件信息

在文件目录flume 下输入以下

bin/flume-ng agent -n  a1 -c conf/ -f nc-flume-log.cof 

打开flume监听

重新打开窗口

设置的是 localhost 连接

[root@hadoop102 ~]$ nc localhost 44444 

hello

10

在监听窗口中可以查看到接收的情况

2022-02-15 13:51:00,236 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:95)] Event: { headers:{} body: 31 30                                           10 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值