Flume實戰二,tail -F的方式監控一個檔案實時採集新增的資料輸出到控制檯
阿新 • • 發佈:2018-11-02
在cd $FLUME_HOME/conf
vim exec-memory-logger.conf
#exec-memory-logger.conf內容 # a1可以看做是flume服務的名稱,每個flume都由sources、channels和sinks三部分組成 # sources可以看做是資料來源頭、channels是中間轉存的渠道、sinks是資料後面的去向 a1.sources = r1 a1.sinks = k1 a1.channels = c1 # 配置Source a1.sources.r1.type = exec a1.sources.r1.command = tail -F /data/a.txt a1.sources.r1.shell = /bin/sh -c #a1.sources.r1.command = for i in /path/*.txt; do cat $i; done # 配置Channel a1.channels.c1.type = memory # 配置Sinks a1.sinks.k1.type = logger # Bind the source and sink to the channel #將指定source(r1)和channel(c1)繫結 #再將sink(k1)和channel(c1)繫結 #則:source(r1)和 sink(k1)已經連通 a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1 $FLUME_HOME/bin/flume-ng agent \ --name a1 \ --conf $FLUME_HOME/conf \ --conf-file $FLUME_HOME/conf/exec-memory-logger.conf \ -Dflume.root.logger=INFO,console