Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between kafka and nifi

I'm a beginner with Apache NiFi, but until now All the tutorial that I read speak about the integration of kafka with Nifi. how it kafka is the complementary of Nifi? why we don't use Nifi directly to pusblish our message without the using of kafka?

Note: All tutorial that I seen does not speak about this point.

like image 583
BERGUIGA Mohamed Amine Avatar asked Nov 29 '18 10:11

BERGUIGA Mohamed Amine


People also ask

What is the difference between Kafka and NiFi?

With throughput speed, data alteration, and data compressions, Apache NiFi carries an edge over Kafka. So, when you are looking for lightning speed, data modulation, and enhanced security, you should opt for Apache NiFi as opposed to Kafka.

Does NiFi use Kafka?

To leverage the highest efficiency of Apache Nifi, you must utilize it as a Kafka producer. This will generate data from any source as an input, which is then forwarded to the Kafka Broker. Basically, Nifi is the replacement for the producer, which delivers data packets to fitting Kafka topics.

What is NiFi used for?

What Apache NiFi Does. Apache NiFi is an integrated data logistics platform for automating the movement of data between disparate systems. It provides real-time control that makes it easy to manage the movement of data between any source and any destination.


2 Answers

NiFi and Kafka complements in the sense that NiFi is not a messaging queue like Apache Kafka. On the contrary, Apache NiFi is a data-flow management aka data logistics tool.

Let's assume this scenario: You have messages (in JSON format) getting streamed through Kafka and you want to validate the messages to check if the message has all the fields and if they are valid, you want the messages to land in HBase.

Here NiFi can help you with the following approach:

  • NiFi has ConsumeKafka processors which you can configure with your Kafka broker and the group name.
  • Use the NiFi processor ValidateRecord to check if the received messages are all valid
  • If they are valid, you can connect the output to PutHBaseRecord

Summarizing, NiFi basically prevents you from writing a lot of boilerplate code. In this case, a custom logic to do schema validation and writing to HBase.

like image 108
Sivaprasanna Sethuraman Avatar answered Sep 21 '22 02:09

Sivaprasanna Sethuraman


Found an interesting answer on Horthonworks community questions, I share it here for the sake of completeness:

  • Apache NiFi and Apache Kafka are two different tools with different use-cases that may slightly overlap. Here is my understanding of the purpose of the two projects.

    NiFi is "An easy to use, powerful, and reliable system to process and distribute data."

    It is a visual tool (with a REST api) that implements flow-based programming to enable the user to craft flows that will take data from a large variety of different sources, perform enrichment, routing, etc on the data as it's being processed, and output the result to a large variety of destinations. During this process, it captures metadata (provenance) on what has happened to each piece of data (FlowFile) as it made its way through the Flow for audit logging and troubleshooting purposes.

  • "Apache Kafka is publish-subscribe messaging rethought as a distributed commit log"

    It is a distributed implementation of the publish-subscribe pattern that allows developers to connect programs to each other in different languages and across a large number of machines. It is more of a building block for distributed computing than it is an all-in-one solution for processing data.

like image 32
amiabl Avatar answered Sep 20 '22 02:09

amiabl