Drivers to use with NiFi

Cloudera JDBC 2.6.20 driver for Apache Impala.  

This release has the following enhancements and fixes:

Enhancements and New Features

Ingest Into the Cloud

Ingest Into the Cloud




Ingesting Data into Apache Kafka in CDP Public Cloud
Describes how to use an Apache NiFi data flow to ingest data into Apache Kafka in CDP Public Cloud.
Ingesting Data into Apache Hive in CDP Public Cloud
Describes how to use an Apache NiFi data flow to ingest data into Apache Hive in CDP Public Cloud.
Ingesting Data into Apache HBase in CDP Public Cloud
Describes how to use an Apache NiFi data flow to ingest data into Apache HBase in CDP Public Cloud.
Ingesting Data into Apache Kudu in CDP Public Cloud
Describes how to use an Apache NiFi data flow to ingest data into Apache Kudu in CDP Public Cloud.
Ingesting Data into Amazon S3 Buckets
Describes how to use an Apache NiFi data flow to ingest data into Amazon S3 buckets in CDP Public Cloud.
Ingesting Data into Azure Data Lake Storage
Describes how to use an Apache NiFi data flow to ingest data into Azure Data Lake Storage in CDP Public Cloud.
Ingesting Data into Google Cloud Storage
Describes how to use an Apache NiFi data flow to ingest data into Google Cloud Storage in CDP Public Cloud.



Other resources:


















Cloud Sources and Sinks
Apache NiFi - Apache Kafka - Apache Hive - Apache HBase - Apache Kudu - Apache Impala - Apache Hadoop - Apache HDFS - AWS S3 - Azure ADLS - Google GCS - Files - REST

Using Apache NiFi in OpenShift and Anywhere Else to Act as Your Global Integration Gateway

Using Apache NiFi in OpenShift and Anywhere Else to Act as Your Global Integration Gateway


What does it look like?



Where Can I Run This Magic Engine:

Private Cloud, Public Cloud, Hybrid Cloud, VM, Bare Metal, Single Node, Laptop, Raspberry Pi or anywhere you have a 1GB of RAM and some CPU is a good place to run a powerful graphical integration and dataflow engine.   You can also run MiNiFi C++ or Java agents if you want it even smaller.


Sounds Too Powerful and Expensive:

Apache NiFi is Open Source and can be run freely anywhere.


For What Use Cases:

Microservices, Images, Deep Learning and Machine Learning Models, Structured Data, Unstructured Data, NLP, Sentiment Analysis, Semistructured Data, Hive, Hadoop, MongoDB, ElasticSearch, SOLR, ETL/ELT, MySQL CDC, MySQL Insert/Update/Delete/Query, Hosting Unlimited REST Services, Interactive with Websockets, Ingesting Any REST API, Natively Converting JSON/XML/CSV/TSV/Logs/Avro/Parquet, Excel, PDF, Word Documents, Syslog, Kafka, JMS, MQTT, TCP/IP, UDP, FTP, sFTP, Files, Directories, Google Forms, Object Stores, NoSQL, Lookups, Hosting Web sites, Updates and live SQL on data streams.



 MySQL/REST/MQTT/JMS/REST/Files/S3/Object Stores.   You also have an expert available on NiFi here.   https://www.datainmotion.dev/2019/10/migrating-apache-flume-flows-to-apache_9.html. 

This makes these tasks much easier to develop, deploy, manage and control.  A single Data Engineer can now build, deploy and manage thousands of data streams in batch, microbatch and streams.





How about version control?

NiFi Registry provides easy to integrate version control with full REST API and can export your flows to a Git repository like Github.




DevOps?



How about deployment?

Apache NiFi can run anywhere!

You can run Apache NiFi on a single VM or localhost or laptop:

https://nifi.apache.org/download.html


On OpenShift

https://catalog.redhat.com/software/containers/cdt-common-rns/nifi/6026bb6c2937380b51711b73

https://github.com/rromannissen/nifi-openshift


Apache NiFi Stateless can run all in RAM, one event at a time like a Job or Function as a Service:

https://github.com/SamHjelmfelt/OpenWhisk-YarnDeployment

https://github.com/apache/nifi/blob/7d76bcd5202a8680c952d3a19072087a971d0b69/nifi-nar-bundles/nifi-framework-bundle/nifi-stateless-bundle/README.md


Docker

https://hub.docker.com/r/apache/nifi




What If I don't like easy to use Web UIs?

You can code everything with REST calls:

https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

Okay, maybe not that low-level, what about a CLI?

You can run and install it here:  https://nifi.apache.org/docs/nifi-docs/html/toolkit-guide.html#nifi_CLI



Can I get more information:


I need support:

A partner of Amazon, Google, Microsoft, Oracle, IBM and thousands more, you can trust Cloudera for enterprise cloud hosting, support and development.  Cloudera has a majority of developers of Apache NiFi working on Open Source.

https://www.cloudera.com/products/cdf.html






Automating Starting Services in Apache NiFi and Applying Parameters

Automating Starting Services in Apache NiFi and Applying Parameters

Automate all the things!   You can call these commands interactively or script all of them with awesome devops tools.  Andre and Dan can tell you more about that.


Enable All NiFi Services on the Canvas

By running this three times, I get any stubborn ones or ones that needed something previously running.   This could be put into a loop and check the status before trying again.

nifi pg-list
nifi pg-status
nifi pg-get-services

 The NiFi CLI has interactive help available and also some good documentation:

https://nifi.apache.org/docs/nifi-docs/html/toolkit-guide.html#nifi_CLI


/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  


/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  


/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  


We could then start a process group if we wanted:


nifi pg-start -u http://edge2ai-1.dim.local:8080 -pgid 2c1860b3-7f21-36f4-a0b8-b415c652fc62  


List all process groups


/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-list -u http://edge2ai-1.dim.local:8080   


List Parameters


/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi list-param-contexts -u http://edge2ai-1.dim.local:8080 -verbose  


Set parameters to set parameter context for a process group, you can loop to do all.

  • pgid => parameter group id
  • pcid => parameter context id


I need to put this in a shell or python script:

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-set-param-context -u http://edge2ai-1.dim.local:8080 -verbose -pgid 2c1860b3-7f21-36f4-a0b8-b415c652fc62  -pcid 39f0f296-0177-1000-ffff-ffffdccb6d90


Example

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/scripts/setupnifi.sh


You could also use the NiFi REST API or Dan's awesome Python API (https://nipyapi.readthedocs.io/en/latest/).

References

Migrating from Apache Storm to Apache Flink

 Migrating from Apache Storm to Apache Flink

The first thing you need to do is to not just pick up and dump to a new system, but to see what can be reconfigured, refactored or reimagined.   For some routing, transformation or simple ingest type applications or solution parts you may want to use Apache NiFi.

For others Spark or Spark Streaming can quickly meet your needs.   For simple Thing to Kafka or Kafka to Thing flows, a flow with Kafka Connect is appropriate.   For things that need to run in individual devices, containers, pods you may want to move a small application to NiFi Stateless.    There are also sometimes a simple Kafka Stream application will meet your needs.

For many use cases you can replace a compiled application with some solid Flink SQL code.   For some discussions, check this out.

For some really good information on how to migrate Storm solutions to Flink,  Cloudera has a well documented solution for you:

https://docs.cloudera.com/csa/1.2.0/stormflink-migration/topics/csa-stormflink-migration-process.html


Conceptual

https://docs.cloudera.com/csa/1.2.0/stormflink-migration/topics/csa-stormflink-concept.html



Architecture

https://docs.cloudera.com/csa/1.2.0/stormflink-migration/topics/csa-stormflink-architecture.html





Redistribution

https://docs.cloudera.com/csa/1.2.0/stormflink-migration/topics/csa-stormflink-redistribution.html


References


FLaNK: Real-Time Transit Information For NY/NJ/CT (TRANSCOM)

 FLaNK:   Real-Time Transit Information For NY/NJ/CT (TRANSCOM)

SOURCE: XML/RSS REST ENDPOINT 
FREQUENCY:  Every Minute
DESTINATIONS:   HDFS, Kudu/Impala, Cloud, Kafka




The main source of this real-time transit updates for New Jersey, New York and Connecticut is TRANSCOM.   I will read from this datasource every minute to know about real-time traffic events that occurring on the roads and transportation systems near me.   We will be reading the feed that is in XML/RSS format and parse out the hundreds of events that come with each minutes update.   

I want to store the raw XML/RSS file in S3/ADLS2/HDFS or GCS, that's an easy step.   I will also parse and enhance this data for easier querying and tracking.

I will add to all events a unique ID and a timestamp as the data is streaming by.   I will store my data in Impala/Kudu for fast queries and upserts.   I can then build some graphs, charts and tables with Apache Hue and Cloudera Visual Applications.   I will also publish my data as AVRO enhanced with a schema to Kafka so that I can use it from Spark, Kafka Connect, Kafka Streams and Flink SQL applications.



  1. GenerateFlowFile - optional scheduler
  2. InvokeHTTP - call RSS endpoint
  3. PutHDFS - store raw data to Object or File store on premise or in the cloud via HDFS / S3 / ADLSv2 / GCP / Ozone / ...
  4.  QueryRecord - convert XML to JSON
  5. SplitJSON - break out individual events


  1. UpdateAttribute - set schema name
  2. UpdateRecord - generate an add a unique ID and timestamp
  3. UpdateRecord - clean up the point field
  4. UpdateRecord - remove garbage whitespace



  1. PutKudu - upsert new data to our Impala / Kudu table.
  2. RetryFlowFile - retry if network or other connectivity issue.

Send Messages to Kafka




Our flow has delivered many messages to our transcomevents topic as schema attached Apache Avro formatted messages.






SMM links into the Schema Registry and schema for this topic.


We use a schema for validation and as a contract between consumers and producers of these traffic events.


Since events are streaming into our Kafka topic and have a schema, we can query them with Continuous SQL with Flink SQL.  We can then run some Continuous ETL.



We could also consume this data with Structured Spark Streaming applications, Spring Boot apps, Kafka Streams, Stateless NiFi and Kafka Connect applications.

We also stored our data in Impala / Kudu for permanent storage, ad-hoc queries, analytics, Cloudera Visualizations, reports, applications and more.










It is very easy to have fast data against our agile Cloud Data Lakehouse.

Source Code



Resources