flume1.4安装

解压

tar -zxvf apache-flume-1.6.0-bin.tar.gz
tar -zxvf apache-flume-1.6.0-src.tar.gz

 copy src中的内容到bin中

cp -ri apache-flume-1.6.0-src/* apache-flume-1.6.0-bin/

 在conf创建example文件

#agent1表示代理名称
agent1.sources=source1
agent1.sinks=sink1
agent1.channels=channel1

#配置source1
agent1.sources.source1.type=spooldir
agent1.sources.source1.spoolDir=/root/hmbbs
agent1.sources.source1.channels=channel1
agent1.sources.source1.fileHeader = false
agent1.sources.source1.interceptors = i1
agent1.sources.source1.interceptors.i1.type = timestamp

#配置sink1
agent1.sinks.sink1.type=hdfs
agent1.sinks.sink1.hdfs.path=hdfs://centos:9000/hmbbs
agent1.sinks.sink1.hdfs.fileType=DataStream
agent1.sinks.sink1.hdfs.writeFormat=TEXT
agent1.sinks.sink1.hdfs.rollInterval=1
agent1.sinks.sink1.channel=channel1
agent1.sinks.sink1.hdfs.filePrefix=%Y-%m-%d

#配置channel1
agent1.channels.channel1.type=file
agent1.channels.channel1.checkpointDir=/root/hmbbs_tmp/123
agent1.channels.channel1.dataDirs=/root/hmbbs_tmp/

 启动

bin/flume-ng agent -n agent1 -c conf -f conf/example -Dflume.root.logger=DEBUG,console

 在hmbbs目录创建一个文件,flume会把它自动上传到hdfs上

猜你喜欢

转载自mvplee.iteye.com/blog/2237950