1.1、FLUME官网地址: Flume官网
Flume is a** distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log data. It has a simple and flexible architecture based on streaming data flows. It is robust and fault tolerant with tunable reliability mechanisms and many failover and recovery mechanisms. It uses a simple extensible data model that allows for online analytic application.
Flume最重要的是,实时读取本地磁盘的日志数据,将数据写入HDFS,这一点决定了Flume的采集一定不在大数据集群**。
**
1.2、FLUME的基础架构
1.2.1 Agent
Agent是一个**JVM进程**,它以事件的形式将数据从源头送至目的。
Agent主要有3个部分组成,**Source、Channel、Sink**。
1.2.2 Source
Source是负责接收数据到Flume Agent的组件。Source组件可以处理各种类型、各种格式的日志数据,包括**avro、thrift、exec、jms、spooling directory、netcat、 taildir 、sequence generator、syslog、http、legacy。**
1.2.3 Sink
Sink**不断地轮询Channel中的事件且批量地移除它们,并将这些事件批量写入到存储或索引系统、或者被发送到另一个Flume Agent**。
Sink组件目的地包括**hdfs、logger、avro、thrift、ipc、file、HBase**、solr、自定义。
1.2.4 Channel
Channel是位于Source和Sink之间的缓冲区。因此,Channel允许Source和Sink运作在**不同的速率**上。Channel是线程安全的,可以同时处理几个Source的写入操作和几个Sink的读取操作。
Flume自带两种Channel:**Memory Channel和File Channel**。
Memory Channel**是内存中的队列。Memory Channel在不需要关心数据丢失的情景下适用。如果需要关心数据丢失,那么Memory Channel就不应该使用,因为程序死亡、机器宕机或者重启都会导致数据丢失。
File Channel将所有事件写到磁盘。因此在程序关闭或机器宕机的情况下不会丢失数据**。
1.2.5 Event
传输单元,**Flume数据传输的基本单元,以Event的形式将数据从源头送至目的地。Event由Header和Body**两部分组成,Header用来存放该event的一些属性,为K-V结构,Body用来存放该条数据,形式为字节数组。
Header | Body |
---|---|