1.下载
http://mirrors.tuna.tsinghua.edu.cn/apache/flume/1.7.0/
2.上传到服务器并解压
上传apache-flume-1.7.0-bin.tar.gz到/home/youxin/hadoop,然后解压缩
tar -zxvf apache-flume-1.7.0-bin.tar.gz
3.修改配置文件
cd apache-flume-1.7.0-bin/conf
cp flume-env.sh.template flume-env.sh
vi flume-env.sh4.验证
Flume 1.7.0
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: 511d868555dd4d16e6ce4fedc72c2d1454546707
Compiled by bessbd on Wed Oct 12 20:51:10 CEST 2016
From source with checksum 0d21b3ffdc55a07e1d08875872c00523
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.channels = c1
a1.sources.r1.command = tail -f /home/youxin/api/log/api8888.log
# Describe the sink
a1.sinks.k1.type = logger
# Use a channel which 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
启动agent a1
/home/youxin/hadoop/apache-flume-1.7.0-bin/bin/flume-ng agent -c . -f /home/youxin/hadoop/apache-flume-1.7.0-bin/conf/exec_tail.conf -n a1 -Dflume.root.logger=INFO,console
2016-12-15 16:18:08,334 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:95)] Event: { headers:{} body: 5B 49 20 31 36 31 32 31 35 20 31 36 3A 31 38 3A [I 161215 16:18: }
2016-12-15 16:18:08,335 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:95)] Event: { headers:{} body: 5B 49 20 31 36 31 32 31 35 20 31 36 3A 31 38 3A [I 161215 16:18: }
2016-12-15 16:18:08,337 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:95)] Event: { headers:{} body: 5B 49 20 31 36 31 32 31 35 20 31 36 3A 31 38 3A [I 161215 16:18: }
2016-12-15 16:18:08,338 (SinkRunner-PollingRunner-Defaul .....