Flume 的使用案例

本文详细介绍了如何在单节点上设置Flume,包括运行master、node,配置logical node,以及物理节点与逻辑节点的关联。通过实例演示,清晰区分物理节点与逻辑节点,并展示如何完成单机Flume实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Part I.  单节点上设置,

1. dump command

The command’s syntax is flume dump <source> [<outputformat>]. It prints data from<source> to the console. Optionally, an output format can be specified, otherwise the default text format is used.

if you want a text file where each line represents a new event, run the following command.

$ flume dump 'text("/etc/services")'

This command reads the file, and then outputs each line as a new event to console.  console是默认的sink, 运行这个命令就自动进入console了。 


2.   单节点上一般

(1) 运行master,flume需要一个master: flume master

(2)运行一个node,通过flume启动的都是physical node: flume node_nowatch -n hostname_phys_1; 

(3) 通过flume shell, 配置一个config, 这里就建立起logical node了: exec config local_tTOt 'text("/home/admin/test1.txt")' 'text("/home/admin/test2.txt")'

怎么样,通过以上例子,物理节点和逻辑节点一下子就分清楚 了吧!   "/home/biadmin/test1.txt"(这个文件一般要求先创建的), sink的,则flume会负责。

(4) exec map hostname_phys_1  local_tTOt; 这一步就把物理节点和逻辑节点map or关联起来。

这样一个完整的单机实现flume的例子就完成了,查看文件/home/admin/test2.txt, 可以看到结果了。


Part II. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值