一、概述
官網
http://flume.apache.org/FlumeUserGuide.html#hdfs-sink
Cloudera 公司開發的實時的日誌採集-> 捐獻給了apache
適用於實時的數據分析 (spark)
同樣也可以用於離線的分析 (hive)
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 是一個分佈式的,高可用的 是一個 收集 聚集 移動(流式處理) 日誌收集系統
Flume 僅僅運行在unix環境下(linux)
Flume 只有一個角色 Agent 該角色下存在:
- Source 用於採集數據的組件,在source裏產生數據流,同時會把數據流傳輸給Channel
- Channel 主要是連接source 和sink的組件有點類似於隊列
- Sink 從channel收集數據,將數據寫到目標源 可以將目標源設置爲HDFS 目錄
在flume中傳輸的最小單元爲event, source將數據封裝到evnet裏 sink拿到event
Event組件
本身就是一個字節數組
Header 頭信息 key value
Body 主體: 字節數組 存儲數據的詳細內容
一個行文本的內容就會被序列化爲一個event
Event 的最大字節爲2048
超過了大小,會進行切割 存放到下個event
Event的默認編碼爲UTF-8