Flume的简单介绍、架构、OG、NG、核心组件
官网 : http://flume.apache.org/
为什么要使用Flume
主要作用:海量日志采集、聚合和传输的系统
支持在日志系统中制定各类数据发送方,用户收集数据;提供对数据进行简单处理,可写到各种数据接收方(文本、HDFS、HBase)
Flume可靠性
- End-to-end:先写在磁盘上,当数据传送成功后,在删除;如果数据发送失败,可以重新发送
- Store on failure : scribe采用的策略,当数据放crash时,将数据写到本地,待恢复后,继续发送
- Best effort:数据发送到接收后,不会进行确认
Flume架构
版本:Flume OG 0.9x ,
![1](https://s1.ax1x.com/2020/04/05/GBo4ne.png)
Flume NG 1.x
![2](https://s1.ax1x.com/2020/04/05/GBofXD.png)
![3](https://s1.ax1x.com/2020/04/05/GBo50H.png)
![4](https://s1.ax1x.com/2020/04/05/GBTpAs.png)
agent中过程
- 1 source —> n channel
- 1 channel —> 1sink
- 1 sink ----> channel
核心组件介绍
![5](https://s1.ax1x.com/2020/04/05/GBoTAA.png)
flume.source
![6](https://s1.ax1x.com/2020/04/05/GBoW6O.png)
flume.channel
flume.sink
![8](https://s1.ax1x.com/2020/04/05/GBoq9P.png)
Flume配置文件的编写
配置文件规则:source_channel_sink
配置文件名内容:
#定义各个组件
agent1.sources = src
agent1.channels = ch
agent1.sinks = des
#配置source,channel,sink
agent1.sources.src.type = exec
agent1.sources.src.command = tail -F /data/mydata/sample_data
agent1.channels.ch.type = memory
agent1.sinks.des.tyoe = logger
#关联(用点把线连起来)
agent1.sources.src.channels = ch
agent1.sinks.des.channel = ch
配置文件的调用:
flume-ng agent \
-c /data/script \
-f /data/script/exec_mem_logger.conf \
-n agent1 \
-D flume.root.logger=DEBUG,console
#-c 配置文件存放的目录
#-f 所使用的配置文件路径
#-n agent的名称