什么是NiFi
Put simply NiFi was built to automate the flow of data between systems. While the term dataflow is used in a variety of contexts, we use it here to mean the automated and managed flow of information between systems.
NiFi是一種數(shù)據(jù)流處理工具匣吊,可以將處在不同系統(tǒng)(數(shù)據(jù)庫)中的數(shù)據(jù)進行統(tǒng)一的ETL芽狗,并進行存儲。在不同的系統(tǒng)間進行數(shù)據(jù)的導(dǎo)入導(dǎo)出。NiFi具備圖形化的Web界面硼控,用戶能夠通過簡單的拖拽連線蜈块,將數(shù)據(jù)以流的形式在不同的系統(tǒng)中處理袖瞻。NiFi可以在集群上部署辙诞。
NiFi能解決什么問題
簡單的說,如果你有三個數(shù)據(jù)庫(數(shù)據(jù)倉庫)量淌,Mysql骗村,Hive,Hbase。存儲著你需要的某些有關(guān)聯(lián)的數(shù)據(jù)呀枢,你想要將三個數(shù)據(jù)庫中的數(shù)據(jù)抽取出來胚股,做某些處理后統(tǒng)一存儲在某個數(shù)據(jù)庫中。NiFi封裝了對各個數(shù)據(jù)庫的接口裙秋,在圖形化界面中連接各個Processor,能夠很輕松的實現(xiàn)這個需求琅拌。
NiFi的核心概念
NiFi是基于流的編程(Flow Basical Programming, FBP)的一種實現(xiàn)。下面簡要介紹下NiFi的一些基本概念以及與FBP術(shù)語的一些聯(lián)系摘刑。
NiFi Term | FBP Term | Description |
---|---|---|
FlowFile | Information Packet | 數(shù)據(jù)被NiFi抽取出來后是以FlowFile的形式進行操作的进宝,以字段的key/value鍵值對的形式進行存儲 |
FlowFile Processor | Black Box | 流文件處理器的對數(shù)據(jù)進行合并、路由枷恕、轉(zhuǎn)換和調(diào)制解調(diào)等處理 |
Connection | Bounded Buffer | 將Processor進行關(guān)聯(lián)党晋,以隊列的形式操作,并且能夠以不同的速率在不同的processes中交互 |
Flow Controller | Scheduler | Flow Controller維護著Processor對線程的管理和分配徐块,充當(dāng)不同Processor的協(xié)調(diào)者(broker) |
Process Group | subnet | 一些列處理的集合未玻,可以通過合并多個component來創(chuàng)建一個新的components |
NiFi的架構(gòu)
NiFi是運行在JVM之上的。
Web Server
NiFi能開啟web服務(wù)胡控,用戶通過訪問該服務(wù)器獲取web圖形界面扳剿,來與NiFi進行交互。
Flow Controller
NiFi最主要的部分铜犬,主要在這部分進行編程
Extensions
擴展部分
FlowFile Repository
追蹤Flow File的狀態(tài)
Content Repository
FlowFile的內(nèi)容實際的活動位置
Provenance Repository
The Provenance Repository is where all provenance event data is stored. The repository construct is pluggable with the default implementation being to use one or more physical disk volumes. Within each location event data is indexed and searchable.
NiFi也可部署在集群上
每個NiFi節(jié)點都做著同樣的數(shù)據(jù)處理工作舞终,集群通過zookeeper來選舉一個Cluster Coordinator,集群中的每個Node通過心跳機制向Cluster Coordinator匯報狀態(tài)信息轻庆。此外癣猾,每個集群都由zookeeper選舉一個主節(jié)點敛劝。故障切換同樣由zookeeper控制。