Flume 的使用案例

来源:互联网 发布:工作牌制作软件 编辑:程序博客网 时间:2024/05/16 23:38

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.