前提:已解压flume包改名后放于/usr/local/src
vi /etc/profile
export FLUME_HOME=/usr/local/src/flume
export PATH=$PATH:${FLUME_HOME}/bin
source /etc/profile
cd /usr/local/src/flume/conf/
cp flume-env.sh.template flume-env.sh
vi flume-env.sh
export JAVA_HOME=/usr/local/src/jdk
flume-ng version
cd /usr/local/src/flume
vi simple-hdfs-flume.conf(若从节点也搭flume,需把以下配置文件中的node01改成node02和 node03)
a1.sources=r1
a1.sinks=k1
a1.channels=c1
a1.sources.r1.type=spooldir
a1.sources.r1.spoolDir=/usr/local/src/hadoop/logs/
a1.sources.r1.fileHeader=true
a1.sinks.k1.type=hdfs
a1.sinks.k1.hdfs.path=hdfs://node01:9000/tmp/flume
a1.sinks.k1.hdfs.rollsize=1048760
a1.sinks.k1.hdfs.rollCount=0
a1.sinks.k1.hdfs.rollInterval=900
a1.sinks.k1.hdfs.useLocalTimeStamp=true
a1.channels.c1.type=file
a1.channels.c1.capacity=1000
a1.channels.c1.transactionCapacity=100
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
start-all.sh
flume-ng agent --conf-file simple-hdfs-flume.conf --name a1