打開官網,
documentation目錄下,user guide
setup中的例子拷貝出來修改
FLUME使用主要是寫配置文件:
配置Source
配置Channel
配置Sink
串聯Source、Chanel、Sink
a1:agent的名稱
r1:Source的名稱
c1:Channel的名稱
k1:Sink的名稱
# example.conf: A single-node Flume configuration
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
# Describe the sink
a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
啓動agent
flume-ng agent -n a1 -c $FLUME_HOME/conf -f $FLUME_HOME/conf/example.conf -Dflume.root.logger=INFO,console
flume-ng agent \
--name a1 \
--conf $FLUME_HOME/conf \
--conf-file $FLUME_HOME/conf/example.conf \
-Dflume.root.logger=INFO,console
測試登錄控制檯
使用telnet xxx(主機名) 44444
輸入信息,切換查看flume輸出