#cd /usr/local/
#mkdir flume
#cd flume
下载压缩包
#wget http://archive.cloudera.com/cdh5/cdh/5/flume-ng-1.6.0-cdh5.7.1.tar.gz
解压
#tar zxvf flume-ng-1.6.0-cdh5.7.1.tar.gz
配置环境变量:
#vim /ect/profile
export FLUME_HOME=/home/hadoop/app/cdh/flume-1.6.0-cdh5.7.1
export PATH=$PATH:$FLUME_HOME/bin
版本验证:
#flume-ng version
cd /usr/local/flume/example/
# cp /usr/local/flume/conf/flume-conf.properties.template /usr/local/flume/example/netcat.conf
// 配置netcat.conf用于实时获取另一终端输入的数据
# vim example/netcat.conf
# 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 that buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
// 运行FlumeAgent,监听本机的44444端口
flume-ng agent -c /usr/local/flume/conf/ -f /usr/local/flume/example/netcat.conf -n a1 -Dflume.root.logger=INFO,console
// 打开另一终端,通过telnet登录localhost的44444,输入测试数据
#telnet localhost 44444
// 查看flume收集数据情况