#cd /usr/local/
#mkdir flume
#cd flume
Download the compressed package
#wget http://archive.cloudera.com/cdh5/cdh/5/flume-ng-1.6.0-cdh5.7.1.tar.gz
decompress
#tar zxvf flume-ng-1.6.0-cdh5.7.1.tar.gz
Configure environment variables:
#vim /ect/profile
export FLUME_HOME=/home/hadoop/app/cdh/flume-1.6.0-cdh5.7.1
export PATH=$PATH:$FLUME_HOME/bin
Version verification:
#flume-ng version
cd /usr/local/flume/example/
# cp /usr/local/flume/conf/flume-conf.properties.template /usr/local/flume/example/netcat.conf
// Configure netcat.conf to obtain the data input by another terminal in real time
# 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
// Run FlumeAgent and listen to port 44444 of this machine
flume-ng agent -c /usr/local/flume/conf/ -f /usr/local/flume/example/netcat.conf -n a1 -Dflume.root.logger=INFO,console
// Open another terminal, log in to localhost's 44444 through telnet, and enter test data
#telnet localhost 44444
// View the data collected by flume