安装很简单,去下载安装包,然后解压,在系统中配置环境变量,安装包中conf下面的flume-env.sh中export JAVA_HOME=
即可,安装完成后运行 安装包下bin/flume-ng version即可看到版本信息。
flume的使用基本是靠配置,只要把你所需要的框架搞懂,剩下的就很简单了。
一般将配置文件保存为 xxx.conf,运行的命令如下,其中conf就是conf文件夹,conf-file就是编写的conf文件,name是conf文件中这个flume的名称(flume格式需要参考官网 点击打开链接)
案例:
# example.conf: A single-node Flume configuration # Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source a1.sources.r1.type = netcat a1.sources.r1.bind = localhost a1.sources.r1.port = 44444 # 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
$ bin/flume-ng agent --conf conf --conf-file example.conf --name a1 -Dflume.root.logger=INFO,console
下面说一下flume的结构,图片都是直接从官网拿过来的
最简单的,就自己采集自己保存
然后这个结构可以串起来,即一个采集可以输出到下一个flume中
扫描二维码关注公众号,回复:
2231598 查看本文章
可以多个采集输出到一起
一个数据源输出到多个地方
从以上的几种机构可以得出:
一个agento内,
(1)一个数据源可以拿给多个channel,最后通过多个sink输出到多个地方
(2)每个channel只能连接一个resource和sink,每个sink也只能输出到一个地方
不能一个channel连接多个sink,行不通!!!!!