1、什么是Apache Flume
java
官网: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.
git
一、flume是一个 分布式的 日志 收集系统 ,具备高可靠、高可用、事务管理、失败重启等功能。数据处理速度快,彻底能够用于生产环境。
经常使用的分布式日志收集系统:
Apache Flume、
Facebook Scribe、
Apache Chukwa
二、flume的核心是 agent 。agent是一个java进程,运行在日志收集端,经过agent接收日志,而后暂存起来,再发送到目的地。
三、agent里面包含3个核心组件:source、channel、sink。apache
3.一、 source 组件是专用于收集日志的,能够处理各类类型各类格式的日志数据,包括avro、thrift、exec、jms、spooling directory、netcat、 sequence generator、syslog、http、legacy、自定义。source组件把数据收集来之后,临时存放在channel中。
3.二、 channel 组件是在agent中专用于临时存储数据的,能够存放在memory、jdbc、file、自定义。
channel中的数据只有在sink发送成功以后才会被删除。
3.三、 sink 组件是用于把数据发送到目的地的组件,目的地包括hdfs、logger、avro、thrift、ipc、file、null、hbase、solr、自定义。
四、在整个数据传输过程当中,流动的是event。事务保证是在event级别。
五、flume能够支持 多级flume的agent ,支持扇入(fan-in)、扇出(fan-out)。app
Flume简单处理示意图
分布式
Flume复杂处理示意图flex
2、Flume安装配置
spa
2.一、下载Flume日志
Flume下载连接
code
2.二、解压缩
orm
cd /home/yujianxin/flume
tar -zxvf apache-flume-1.6.0-src.tar.gz ; tar -zxvf apache-flume-1.6.0-bin.tar.gz
而后把src文件夹中的内容所有复制到bin文件夹
2.三、配置Flume环境变量
export FLUME_HOME=xxx/flume-1.6.0-bin
export path=$path:$FLUME_HOME/bin
3、 验证Flume安装是否成功
$ flume-ng version
Flume 1.6.0
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: 2561a23240a71ba20bf288c7c2cda88f443c2080
Compiled by hshreedharan on Mon May 11 11:15:44 PDT 2015
From source with checksum b29e416802ce9ece3269d34233baf43f
OK!出现如上截图,说明Flume成功安装。Flume的使用请关注后续博文。