Flume:(三)FLUME使用(监听端口输出信息到控制台)

打开官网,
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输出

 

 

你可能感兴趣的:(Flume)