Flume的简单案例二 读取本地文件

本文详细介绍了如何使用Flume创建一个Agent,配置执行文件tail-F监听/tmp/input.txt,展示了从文件写入到日志记录的整个过程。重点在于源(source)、通道(channel)和sink(sink)的设置。
摘要由CSDN通过智能技术生成

1)创建Flume Agent配置文件 flume-file-logger.conf

2)在配置文件中添加以下内容 参照https://flume.apache.org/FlumeUserGuide

# example.conf: A single-node Flume configuration
 
# Name the components on this agent
a2.sources = r2
a2.sinks = k2
a2.channels = c2
 
# Describe/configure the source
a2.sources.r2.type = exec
a2.sources.r2.command = tail -F /tmp/input.txt
a2.sources.r2.shell = /bin/bash -c
 
# Describe the sink
a2.sinks.k2.type = logger
 
# Use a channel which buffers events in memory
a2.channels.c2.type = memory
a2.channels.c2.capacity = 1000
a2.channels.c2.transactionCapacity = 100
 
# Bind the source and sink to the channel
a2.sources.r2.channels = c2
a2.sinks.k2.channel = c2

3) Flume启动agent a2,然后往文件 /tmp/input.txt file中添加内容。我们可以看到消息传了过来。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值