flume入门篇
下载
从http://flume.apache.org/download.html下载二进制版本
安装
tar zvxf apache-flume-1.6.0-bin.tar.gz
目录结构
bin - 包含启动脚本
conf - 包含配置文件模板
docs - 包含文档
lib - 依赖的jar包
tools - 包含log4j appender的实现
配置文件结构
1)主要结构
2)顶层
<agent-name>.sources=<source> <source> <agent-name>.channels=<channel> <channel> <agent-name>.sinks=<sink> <sink>
3)底层
<agent-name>.<component-type>.<component-name>.<configuration-parameter>=<value>
4)实例single-node-demo.properties
a1.sources=src1 a1.sinks=sink1 a1.channels=ch1 # Configure the source a1.sources.src1.type=netcat a1.sources.src1.bind=localhost a1.sources.src1.port=51000 # Sink Configuration a1.sinks.sink1.type=logger # Channel configuration a1.channels.ch1.type=memory a1.channels.ch1.capacity=1000 a1.channels.ch1.transactionCapacity=100 # Link stuff together a1.sources.src1.channels=ch1 a1.sinks.sink1.channel=ch1
启动agent
$bin/flume-ng agent --conf-file conf/single-node-demo.properties --name a1 --conf ./conf/ -Dflume.root.logger=INFO,console
也可以简写为
bin/flume-ng agent -c conf/single-node-demo.properties -n a1 -f ./conf/ -Dflume.root.logger=INFO,console
-c 相当于--conf-file
-f 相当于--conf
-n 相当于--name
netcat发消息
nc localhost 51000 hello OK world OK
看flume的输出
2016-01-12 22:11:20,603 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: 68 65 6C 6C 6F hello } 2016-01-12 22:11:20,603 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: 77 6F 72 6C 64 world }
相关推荐
chenguangchun 2020-07-26
myt0 2020-07-18
IT影风 2020-07-18
chenguangchun 2020-06-28
jiaomrswang 2020-06-26
myt0 2020-06-16
xiaoxiaojavacsdn 2020-06-08
zzjmay 2020-06-07
strongyoung 2020-06-04
ErixHao 2020-05-20
啦啦啦啦啦 2020-05-15
wanfuchun 2020-05-14
onwaygoahead 2020-05-05
xiaoxiaojavacsdn 2020-05-01
chenguangchun 2020-04-18
QAnyang 2020-03-14
wsong 2020-03-13