Migrating Apache Flume Flows to Apache NiFi: Kafka Source to HDFS / Kudu / File / Hive
Published: 2019-12-03 21:49:38

---
title: Migrating Apache Flume Flows to Apache NiFi: Kafka Source to HDFS / Kudu / File / Hive
published: true
date: 2019-10-04 22:07:00 UTC
tags: 
canonical_url: 
---

### Migrating Apache Flume Flows to Apache NiFi: Kafka Source to HDFS / Kudu / File / Hive

**Article 7 - ** [https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache\_9.html](https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache_9.html)

**Article 6 - ** [https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache\_35.html](https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache_35.html)  
**Article 5 - **  
**Article 4 - ** [https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache\_8.html](https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache_8.html)

**Article 3 - ** [https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache\_7.html](https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache_7.html)

**Article 2 - ** [https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache.html](https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache.html)

**Article 1** - [https://www.datainmotion.dev/2019/08/migrating-apache-flume-flows-to-apache.html](https://www.datainmotion.dev/2019/08/migrating-apache-flume-flows-to-apache.html)

**Source Code:  ** [https://github.com/tspannhw/flume-to-nifi](https://github.com/tspannhw/flume-to-nifi)

  

This is one possible simple, fast replacement for "[Flafka](https://blog.cloudera.com/flafka-apache-flume-meets-apache-kafka-for-event-processing/)".

  

  

  

[![](https://1.bp.blogspot.com/-OpFBDcIOMoA/XZe-_p1-FGI/AAAAAAAAYco/7T9Ip16ijfo1Me7BrVJjgrd8-FdqUckRgCLcBGAsYHQ/s640/flumereplacementgraph.png)](https://1.bp.blogspot.com/-OpFBDcIOMoA/XZe-_p1-FGI/AAAAAAAAYco/7T9Ip16ijfo1Me7BrVJjgrd8-FdqUckRgCLcBGAsYHQ/s1600/flumereplacementgraph.png)

  

### Consume / Publish Kafka And Store to Files, HDFS, Hive 3.1, Kudu

[![](https://1.bp.blogspot.com/--Jb0UFtHXPA/XZe_BNKusbI/AAAAAAAAYdQ/QAT5f2ed254nCon_gBYR8srghyeZ8LNOwCLcBGAsYHQ/s640/nifikafkaflowoverview.png)](https://1.bp.blogspot.com/--Jb0UFtHXPA/XZe_BNKusbI/AAAAAAAAYdQ/QAT5f2ed254nCon_gBYR8srghyeZ8LNOwCLcBGAsYHQ/s1600/nifikafkaflowoverview.png)

  

  

### Consume Kafka Flow 

[![](https://1.bp.blogspot.com/-X9gD9lYBNLw/XZe_Ar323iI/AAAAAAAAYdM/4ofJq1QqDxIDOn9okBT9pbuFyGGCz4m6ACLcBGAsYHQ/s640/nififlowconsumekafkatostore.png)](https://1.bp.blogspot.com/-X9gD9lYBNLw/XZe_Ar323iI/AAAAAAAAYdM/4ofJq1QqDxIDOn9okBT9pbuFyGGCz4m6ACLcBGAsYHQ/s1600/nififlowconsumekafkatostore.png)
  

  

###  Merge Records And Store As AVRO or ORC

[![](https://1.bp.blogspot.com/-zuMeAlOlEPQ/XZe_By7egHI/AAAAAAAAYdc/ZZ3bhdYuno4KNCOG6kYs6ZkJktD_CZAOgCLcBGAsYHQ/s640/puthdfsorcjson.png)](https://1.bp.blogspot.com/-zuMeAlOlEPQ/XZe_By7egHI/AAAAAAAAYdc/ZZ3bhdYuno4KNCOG6kYs6ZkJktD_CZAOgCLcBGAsYHQ/s1600/puthdfsorcjson.png)

  

### Consume Kafka, Update Records via Machine Learning Models In CDSW And Store to Kudu

[![](https://1.bp.blogspot.com/-eHO7qI9-pXQ/XZe-_BREXoI/AAAAAAAAYcc/XrkzAoPjMJM2CCtnb5FU-ErDwdjO8vQDQCLcBGAsYHQ/s640/consumeupdatestore.png)](https://1.bp.blogspot.com/-eHO7qI9-pXQ/XZe-_BREXoI/AAAAAAAAYcc/XrkzAoPjMJM2CCtnb5FU-ErDwdjO8vQDQCLcBGAsYHQ/s1600/consumeupdatestore.png)

  

  

### Source:  Apache Kafka Topics

[![](https://1.bp.blogspot.com/-lWHipGr1ac8/XZe--kD25qI/AAAAAAAAYeA/yK8EwxIPUosEQpTgjRTMOWmCTMS9GdNWgCEwYBhgL/s640/consumerkafka.png)](https://1.bp.blogspot.com/-lWHipGr1ac8/XZe--kD25qI/AAAAAAAAYeA/yK8EwxIPUosEQpTgjRTMOWmCTMS9GdNWgCEwYBhgL/s1600/consumerkafka.png)

  

You enter a few parameters and start ingesting data with or without schemas.   Apache Flume had no Schema support.   Flume did not support transactions.

  

[![](https://1.bp.blogspot.com/-9kbZFx91HsM/XZe-9PfGaiI/AAAAAAAAYeA/KGU9jCQpyaM3ij6YBlMmMehKqb9QDv0sQCEwYBhgL/s640/ClouderaSchemaRegistry.png)](https://1.bp.blogspot.com/-9kbZFx91HsM/XZe-9PfGaiI/AAAAAAAAYeA/KGU9jCQpyaM3ij6YBlMmMehKqb9QDv0sQCEwYBhgL/s1600/ClouderaSchemaRegistry.png)

  

  

### Sink:   Files

[![](https://1.bp.blogspot.com/-8WyPjFztZf8/XZe-_9Xhx8I/AAAAAAAAYeE/Q6zVVmCRK6A8olJywKgIc5CqWQn-kTCIACEwYBhgL/s640/huejsondata.png)](https://1.bp.blogspot.com/-8WyPjFztZf8/XZe-_9Xhx8I/AAAAAAAAYeE/Q6zVVmCRK6A8olJywKgIc5CqWQn-kTCIACEwYBhgL/s1600/huejsondata.png)
  

[![](https://1.bp.blogspot.com/-W3Z2LF84MF0/XZe-9BusrHI/AAAAAAAAYeM/Hva2Q0qteVErez3s-nP8Qds4xjYOejIDwCEwYBhgL/s640/PutFile.png)](https://1.bp.blogspot.com/-W3Z2LF84MF0/XZe-9BusrHI/AAAAAAAAYeM/Hva2Q0qteVErez3s-nP8Qds4xjYOejIDwCEwYBhgL/s1600/PutFile.png)
  

[![](https://1.bp.blogspot.com/-7VRXa3ajMOY/XZe_CLLMT2I/AAAAAAAAYeM/e7APMsBvjcM6lOMKIOm2OfpCr0cTFIdgwCEwYBhgL/s640/rawdatahdfs.png)](https://1.bp.blogspot.com/-7VRXa3ajMOY/XZe_CLLMT2I/AAAAAAAAYeM/e7APMsBvjcM6lOMKIOm2OfpCr0cTFIdgwCEwYBhgL/s1600/rawdatahdfs.png)

  

Storing to files in files systems, object stores, SFTP or elsewhere could not be easier.  Choose S3, Local File System, SFTP, HDFS or wherever.

### 

### Sink:   Apache Kudu / Apache Impala

  

[![](https://1.bp.blogspot.com/-unvppPckvJo/XZe--FKMY2I/AAAAAAAAYd4/ur7sODdJJkEb56Fxy93Y8gQrVmUqEofBwCEwYBhgL/s640/PutKudu.png)](https://1.bp.blogspot.com/-unvppPckvJo/XZe--FKMY2I/AAAAAAAAYd4/ur7sODdJJkEb56Fxy93Y8gQrVmUqEofBwCEwYBhgL/s1600/PutKudu.png)

  

Storing to Kudu/Impala (or Parquet for that manner could not be easier with Apache NiFi).

  

[![](https://1.bp.blogspot.com/-aUJ11eK_pZI/XZe_ASTaYWI/AAAAAAAAYd4/87F_fTTlfY4CTuiudAfYZziqb0QQ8-l_QCEwYBhgL/s640/kududata.png)](https://1.bp.blogspot.com/-aUJ11eK_pZI/XZe_ASTaYWI/AAAAAAAAYd4/87F_fTTlfY4CTuiudAfYZziqb0QQ8-l_QCEwYBhgL/s1600/kududata.png)

  

### Sink:   HDFS for Apache ORC Files

  

When completes, the **ConvertAvroToORC** and **PutHDFS** build the Hive DDL for you!  You can build the tables automagically with Apache NiFi if you wish.

  

> CREATE EXTERNAL TABLE IF NOT EXISTS iotsensors  
> (sensor\_id BIGINT, sensor\_ts BIGINT, is\_healthy STRING, response STRING, sensor\_0 BIGINT, sensor\_1 BIGINT,  
> sensor\_2 BIGINT, sensor\_3 BIGINT, sensor\_4 BIGINT, sensor\_5 BIGINT, sensor\_6 BIGINT, sensor\_7 BIGINT, sensor\_8 BIGINT,  
> sensor\_9 BIGINT, sensor\_10 BIGINT, sensor\_11 BIGINT)  
> STORED AS ORC  
> LOCATION '/tmp/iotsensors'

[![](https://1.bp.blogspot.com/-FJ7bOIP1SNM/XZe-9guoNVI/AAAAAAAAYd8/wOokOaqVr9QHIHq_NSnxzqN0kXpiVi31QCEwYBhgL/s640/PutHDFSORC.png)](https://1.bp.blogspot.com/-FJ7bOIP1SNM/XZe-9guoNVI/AAAAAAAAYd8/wOokOaqVr9QHIHq_NSnxzqN0kXpiVi31QCEwYBhgL/s1600/PutHDFSORC.png)
  

[![](https://1.bp.blogspot.com/-aI97rtxxiZ8/XZe_BbDuWbI/AAAAAAAAYeA/rAn_DoM-hj4BzlkTl03-JonHnLItXcsdACEwYBhgL/s640/orcfile.png)](https://1.bp.blogspot.com/-aI97rtxxiZ8/XZe_BbDuWbI/AAAAAAAAYeA/rAn_DoM-hj4BzlkTl03-JonHnLItXcsdACEwYBhgL/s1600/orcfile.png)
  

[![](https://1.bp.blogspot.com/-eQUwC8UsIpQ/XZe-_f9EJsI/AAAAAAAAYeA/c8Y-anxw_g8ruWEeV1xCVNv2a8kaJGt4gCEwYBhgL/s640/createexternalorchdfshivetable.png)](https://1.bp.blogspot.com/-eQUwC8UsIpQ/XZe-_f9EJsI/AAAAAAAAYeA/c8Y-anxw_g8ruWEeV1xCVNv2a8kaJGt4gCEwYBhgL/s1600/createexternalorchdfshivetable.png)
  

[![](https://1.bp.blogspot.com/-aNVNC-agP6k/XZe--fwqCvI/AAAAAAAAYd8/H1Qt7XVhlYQVftvkN7MaLJxzitTWrUVPQCEwYBhgL/s640/autobuildddl.png)](https://1.bp.blogspot.com/-aNVNC-agP6k/XZe--fwqCvI/AAAAAAAAYd8/H1Qt7XVhlYQVftvkN7MaLJxzitTWrUVPQCEwYBhgL/s1600/autobuildddl.png)

  

  

### Sink: Kafka

Publishing to Kafka is just as easy!  Push records with schema references or raw data.  AVRO or JSON, whatever makes sense for your enterprise.

  

Write to data easily with no coding and no changes or redeploys for schema or schema version changes.

[![](https://1.bp.blogspot.com/-sK14Buo1ZYI/XZe_AP4uHPI/AAAAAAAAYeA/-C4hAPtbJMs8UrmSu3gYmtPz9R4pV2zLQCEwYBhgL/s640/jsonsetwriter.png)](https://1.bp.blogspot.com/-sK14Buo1ZYI/XZe_AP4uHPI/AAAAAAAAYeA/-C4hAPtbJMs8UrmSu3gYmtPz9R4pV2zLQCEwYBhgL/s1600/jsonsetwriter.png)
** Pick a Topic and Stream Data While Converting Types**  

[![](https://1.bp.blogspot.com/-hqOcBuwXKtE/XZe_BldbnkI/AAAAAAAAYeM/rCr9-FUOhTYxULei-fbglBeKfByzlWWegCEwYBhgL/s640/publishKafka.png)](https://1.bp.blogspot.com/-hqOcBuwXKtE/XZe_BldbnkI/AAAAAAAAYeM/rCr9-FUOhTYxULei-fbglBeKfByzlWWegCEwYBhgL/s1600/publishKafka.png)
  
  

### Clean UI and REST API to Manage, Monitor, Configure and Notify on Kafka

[![](https://1.bp.blogspot.com/-LbJ2ZiTpdK4/XZe_DFi0zGI/AAAAAAAAYeM/_i6CpPMT57442GmmlOVCBOTrxzTzHH0GACEwYBhgL/s640/smmalerts.png)](https://1.bp.blogspot.com/-LbJ2ZiTpdK4/XZe_DFi0zGI/AAAAAAAAYeM/_i6CpPMT57442GmmlOVCBOTrxzTzHH0GACEwYBhgL/s1600/smmalerts.png)
  

[![](https://1.bp.blogspot.com/-cMZLl44KUe4/XZe_CYl819I/AAAAAAAAYeI/HgpyKNsp9FwiZJtZ8U6HZw34D6u6wk7pQCEwYBhgL/s640/smmKafkaWatch.png)](https://1.bp.blogspot.com/-cMZLl44KUe4/XZe_CYl819I/AAAAAAAAYeI/HgpyKNsp9FwiZJtZ8U6HZw34D6u6wk7pQCEwYBhgL/s1600/smmKafkaWatch.png)
  

[![](https://1.bp.blogspot.com/-XY0jVtf5V5w/XZe_ClWj_WI/AAAAAAAAYeM/eyWtgy1Jops0UE2FsLC3Iqd6DEsO1CMDwCEwYBhgL/s640/smmTopicMetrics.png)](https://1.bp.blogspot.com/-XY0jVtf5V5w/XZe_ClWj_WI/AAAAAAAAYeM/eyWtgy1Jops0UE2FsLC3Iqd6DEsO1CMDwCEwYBhgL/s1600/smmTopicMetrics.png)

  

### Other Reasons to Use Apache NiFi Over Apache Flume

**DevOps with REST API, CLI, Python API**

[https://community.cloudera.com/t5/Community-Articles/More-DevOps-for-HDF-Apache-NiFi-Registry-and-Friends/ta-p/248668](https://community.cloudera.com/t5/Community-Articles/More-DevOps-for-HDF-Apache-NiFi-Registry-and-Friends/ta-p/248668)

  

**Schemas! **  We not only work with semi-structured, structured and unstructured data.  We are schema and schema version aware for CSV, JSON, AVRO, XML, Grokked Text Files and more. [https://community.cloudera.com/t5/Community-Articles/Big-Data-DevOps-Apache-NiFi-HWX-Schema-Registry-Schema/ta-p/247963](https://community.cloudera.com/t5/Community-Articles/Big-Data-DevOps-Apache-NiFi-HWX-Schema-Registry-Schema/ta-p/247963)

### Flume Replacement Use Cases Implemented in Apache NiFi

**Sink/Source:   JMS**

[https://community.cloudera.com/t5/Community-Articles/Publishing-and-Consuming-JMS-Messages-from-Tibco-Enterprise/ta-p/248157](https://community.cloudera.com/t5/Community-Articles/Publishing-and-Consuming-JMS-Messages-from-Tibco-Enterprise/ta-p/248157)

  

**Source:   Files/PDF/PowerPoint/Excel/Word  Sink:  Files**

[https://community.cloudera.com/t5/Community-Articles/Parsing-Any-Document-with-Apache-NiFi-1-5-with-Apache-Tika/ta-p/247672](https://community.cloudera.com/t5/Community-Articles/Parsing-Any-Document-with-Apache-NiFi-1-5-with-Apache-Tika/ta-p/247672)

[https://community.cloudera.com/t5/Community-Articles/Converting-PowerPoint-Presentations-into-French-from-English/ta-p/248974](https://community.cloudera.com/t5/Community-Articles/Converting-PowerPoint-Presentations-into-French-from-English/ta-p/248974)

[https://community.cloudera.com/t5/Community-Articles/Creating-HTML-from-PDF-Excel-and-Word-Documents-using-Apache/ta-p/247968](https://community.cloudera.com/t5/Community-Articles/Creating-HTML-from-PDF-Excel-and-Word-Documents-using-Apache/ta-p/247968)

  

**Source:  Files/CSV  Sink:   HDFS/Hive/Apache ORC**

[https://community.cloudera.com/t5/Community-Articles/Converting-CSV-Files-to-Apache-Hive-Tables-with-Apache-ORC/ta-p/248258](https://community.cloudera.com/t5/Community-Articles/Converting-CSV-Files-to-Apache-Hive-Tables-with-Apache-ORC/ta-p/248258)

  

**Source:  REST/Files/Simulator   Sink:  HBase, Files, HDFS.    ETL with Lookups.**

[https://community.cloudera.com/t5/Community-Articles/ETL-With-Lookups-with-Apache-HBase-and-Apache-NiFi/ta-p/248243](https://community.cloudera.com/t5/Community-Articles/ETL-With-Lookups-with-Apache-HBase-and-Apache-NiFi/ta-p/248243)

  

### Flume Replacement - Lightweight Open Source Agents

[![](https://1.bp.blogspot.com/-Y6gngLR6A90/XZe-_WDXIqI/AAAAAAAAYck/EdNc_rjfTfEYwCJUoXvRPepN5V1cWU54wCLcBGAsYHQ/s640/efmpushtokafka.png)](https://1.bp.blogspot.com/-Y6gngLR6A90/XZe-_WDXIqI/AAAAAAAAYck/EdNc_rjfTfEYwCJUoXvRPepN5V1cWU54wCLcBGAsYHQ/s1600/efmpushtokafka.png)

  

If you need to replace local Log to Kafka agents or anything to Kafka or anything to anything with routing, transformation and manipulation.   You can use Edge Flow Manager deployed MiNiFi Agents available in Java and C++ versions.

### References

- [https://www.progress.com/tutorials/jdbc/ingest-salesforce-data-incrementally-into-hive-using-apache-nifi](https://www.progress.com/tutorials/jdbc/ingest-salesforce-data-incrementally-into-hive-using-apache-nifi)
- [https://community.cloudera.com/t5/Community-Articles/RDBMS-to-Hive-using-NiFi-small-medium-tables/ta-p/244677](https://community.cloudera.com/t5/Community-Articles/RDBMS-to-Hive-using-NiFi-small-medium-tables/ta-p/244677)
- [https://community.cloudera.com/t5/Community-Articles/My-Year-in-Review-2018/ta-p/249363](https://community.cloudera.com/t5/Community-Articles/My-Year-in-Review-2018/ta-p/249363)
- [https://community.cloudera.com/t5/Community-Articles/My-Year-in-Review-2017/ta-p/247541](https://community.cloudera.com/t5/Community-Articles/My-Year-in-Review-2017/ta-p/247541)