tiyna 发表于 2015-11-27 16:56:06

Flume 的使用案例

  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(&quot;/etc/services&quot;)'
  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(&quot;/home/admin/test1.txt&quot;)' 'text(&quot;/home/admin/test2.txt&quot;)'
  怎么样,通过以上例子,物理节点和逻辑节点一下子就分清楚 了吧!   &quot;/home/biadmin/test1.txt&quot;(这个文件一般要求先创建的), sink的,则flume会负责。
  (4) exec map hostname_phys_1local_tTOt; 这一步就把物理节点和逻辑节点map or关联起来。
  这样一个完整的单机实现flume的例子就完成了,查看文件/home/admin/test2.txt, 可以看到结果了。
  


  Part II.
页: [1]
查看完整版本: Flume 的使用案例