1.安裝環境:jdk1.7 ,flume-ng-1.5.0.tar.gz
java
2.解壓flume-ng-1.5.0.tar.gz shell
tar zxf flume-ng-1.5.0.tar.gz
3. 修改flume配置,指定JAVA_HOME,FLUME_HOMEapache
vi flume-env.sh JAVA_HOME=/usr/java/jdk1.7.0_71 vi ~/.bashrc export FLUME_HOME=/data0/apache-flume-1.5.0-bin export PATH=$PATH:$FLUME_HOME/bin source ~/.bashrc
4.編輯配置文件,監控指定文件,收集到控制檯輸出bash
vi exec.conf a1.sources = r1 a1.sinks = k1 a1.channels = c1 # For each one of the sources, the type is defined a1.sources.r1.type = exec a1.sources.r1.shell = /bin/bash -c a1.sources.r1.command = tail -F /data0/1.log a1.channels.c1.type = memory #a1.channels.c1.checkpointDir=/home/hadoop/.flume/channel1/file-channel/checkpoint #a1.channels.c1.dataDirs=/home/hadoop/.flume/channel1/file-channel/data a1.channels.c1.capacity = 1000000 a1.channels.c1.transactionCapacity = 500000 # The channel can be defined as follows. # Each sink's type must be defined a1.sinks.k1.type = logger a1.sinks.k1.channel = c1 a1.sources.r1.channels = c1
5. 啓動flume agent
oop
bin/flume-ng agent -c conf -f conf/exec.conf --name a1 -Dflume.root.logger=INFO,console
echo 123456789 >> /data0/1.log echo 123456789 >> /data0/1.log echo 123456789 >> /data0/1.log