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.