Skip to main content

Data flowing between systems,
with every step recorded.

NiFi automates the flow of data between systems: it receives, routes, transforms, and delivers, and it records every step along the way. Follow a piece of data from the moment it enters NiFi to the end of its life cycle.

A data flow carries information, in an automated and managed way, from the systems that produce it to the systems that consume it.

Apache NiFi is the TDP tool for designing, running, and monitoring these flows between systems.

A piece of data

Attributes and content

Each piece of data travels as a FlowFile: key-value pairs that describe it and the bytes of the data itself.

Between steps

Queues, not direct calls

There is a queue between one step and the next. Each step works at its own pace, and the flow absorbs variations in volume.

Every step

Everything is recorded

NiFi records the provenance of each piece of data: where it came from, what it passed through, what changed, and where it went.

On this page

See a FlowFile move through NiFi​

Press Play or move forward step by step. Underlined names lead to the Glossary.

Outside NiFiWhere the data comes from
WebsitesPages read by the flow
ProcessorsWho works on the data
GetHTTPFetches the start page
InvokeHTTPFetches the URLs found
UpdateAttributeChanges attributes
RouteOnAttributeRoutes by attributes
CompressContentCompresses the content
RepositoriesWhere the data is kept
FlowFile RepositoryAttributes, pointer, and state
Content RepositoryThe bytes of the data
ProvenanceWhat happened
Provenance RepositoryOne event per step
Step 1 of 8

1 GetHTTP creates the FlowFile

GetHTTP fetches a page from the web and creates a FlowFile, which is born with the essential attributes uuid, filename, and path. The FlowFile then receives the content, the page that was read, and new attributes, such as the HTTP headers of the response.

  1. GetHTTP creates the FlowFile. GetHTTP fetches a page from the web and creates a FlowFile, which is born with the essential attributes uuid, filename, and path. The FlowFile then receives the content, the page that was read, and new attributes, such as the HTTP headers of the response.
  2. Each part goes to its own repository. The attributes, the pointer to the content, and the state of the FlowFile go to the FlowFile Repository, a write-ahead log: every change is recorded before it happens. The bytes of the page go to the Content Repository.
  3. The entry becomes history. GetHTTP records a RECEIVE event in the Provenance Repository, with the source URL, the transfer time, and the attributes added. Each event keeps a snapshot of the FlowFile at that moment.
  4. From one processor to the next, by reference. Through the connections, the FlowFile moves on to the next processors. What travels through the queues is a reference to the FlowFile, not the bytes. InvokeHTTP fetches each URL found on the page and creates a response FlowFile, with a status code attribute.
  5. The attribute changes, the content stays. UpdateAttribute replaces the filename with a more descriptive name. NiFi does not alter the previous FlowFile: it creates a new version of the attributes, which keeps pointing to the same content, and records an ATTRIBUTES_MODIFIED event.
  6. One FlowFile becomes two. RouteOnAttribute reads the status code and forwards the FlowFile to two destinations. To do so, it clones the FlowFile: the clone copies the attributes and the pointer, and the content is not copied. A CLONE event and two ROUTE events are recorded.
  7. The content changes: a new copy. CompressContent compresses the content. The stored content does not change: the compressed version is written to a new location in the Content Repository, and the FlowFile now points to it. The earlier events keep pointing to the original content, and this is what makes it possible to replay the flow from that point.
  8. The end of the life cycle. When the data reaches its destination or is discarded by the flow, NiFi records a DROP event. The FlowFile stays in the FlowFile Repository until the next checkpoint. The content is marked for deletion, unless another FlowFile still uses it or archiving is enabled, and the provenance events are kept for the configured period.
Figure 1 - The life of a FlowFile, in a simplified flow based on the WebCrawler example from the NiFi documentation. Processors exchange references. The bytes stay in the Content Repository.

Architecture​

NiFi runs in a JVM, on the operating system of a host.

Apache NiFi architecture: Web Server, Flow Controller, extensions and repositoriesThe client communicates in both directions with NiFi, which runs in a JVM inside the operating system of a host; three hosts appear stacked. In the JVM sit the Web Server, the Flow Controller, with Processor 1 and Extension N, and the repositories: FlowFile Repository, Content Repository and Provenance Repository. The host has local storage, and all hosts connect to ZooKeeper.OS / HOSTOS / HOSTOS / HOSTJVMWeb ServerFlow ControllerProcessor 1Extension NFlowFileRepositoryContentRepositoryProvenanceRepositoryLocal storageClientZooKeeper
Figure 2 - Apache NiFi architecture: Web Server, Flow Controller, extensions, and the three repositories in the JVM of each host. Underlined terms lead to the Glossary.

What the figure shows:

  1. The client communicates with NiFi in both directions.
  2. The Web Server hosts the HTTP-based command and control API of NiFi.
  3. The Flow Controller is the "brains" of the operation: it provides the threads in which the extensions, such as processors, run and decides when each one receives resources.
  4. The three repositories, the FlowFile Repository, the Content Repository and the Provenance Repository, live in the local storage of the host.
  5. ZooKeeper coordinates the hosts of a cluster: in the figure, all hosts connect to it.

Three repositories, three questions

Where is the data now?

FlowFile Repository

The metadata of each active FlowFile: attributes, pointer to the content, and the queue it is in. After a failure, processing resumes from where it stopped.

What does the data contain?

Content Repository

The bytes of the content, current and past. Stored content does not change: each modification creates a new version.

What happened to it?

Provenance Repository

The events of each FlowFile, indexed and searchable: the lineage of the data and the starting point for replaying it.

From the flow to the FlowFile​

What exists on the NiFi canvas: four levels, each inside the other.

Level 1 of 4

Root Process Group

The outermost level of the NiFi canvas. Every component exists inside a process group, and this is where the user starts.

  • Controller ServiceProvides shared configuration, such as keystore and truststore, to the components of the group and of nested groups.
  1. Root Process Group. The outermost level of the NiFi canvas. Every component exists inside a process group, and this is where the user starts.
    • Controller Service. Provides shared configuration, such as keystore and truststore, to the components of the group and of nested groups.
  2. Process Group. A set of processors and connections handled as a single piece. A group can contain other groups: new components are built by composing others.
    • Processor. Does the work: receives, fetches, publishes, routes, transforms, or extracts information from FlowFiles.
    • Port. Input (Input Port) or output (Output Port) of data for the group.
  3. Connection. Links two components and holds the queue of FlowFiles between them. The order in which the queue releases FlowFiles follows the configured prioritizers. The default rule is oldest first.
    • Relationship. The named outcome of processing, such as success or failure, which decides which connection the FlowFile goes to.
    • Back pressure. When the queue reaches the configured limit, the component that feeds it is no longer scheduled.
  4. FlowFile. The unit of data that travels through the flow, made up of attributes and content.
    • Attributes. Key-value pairs, such as uuid, filename, and path, stored in the FlowFile Repository.
    • Content. The bytes of the data, zero or more, stored in the Content Repository.
Figure 3 - How a flow is organized: each level contains the next. The terms alongside accompany each level.

In a cluster​

Each node runs the same flow, each on a different portion of the data.

No fixed leader

Zero-Leader Clustering

The interface of any node serves the cluster, and a change made on one node is replicated to all the others.

Who joins the cluster

Cluster Coordinator

Elected by ZooKeeper, it receives the heartbeats from the nodes, connects and disconnects nodes, and hands the most current flow to those who join.

Who runs alone

Primary Node

Also elected by ZooKeeper, it is the node for isolated processors, such as one that fetches files from a remote directory, which cannot run on all nodes at the same time.

Version-controlled flows​

NiFi Registry stores versions of flows and shares them across NiFi instances.

The NiFi Registry is a subproject of Apache NiFi: a complementary application that provides a central location for storing and managing resources shared across one or more NiFi instances.

A process group can be placed under version control: each saved version goes to the Registry, from where other instances can import it.

Where it lives

Bucket

A container that organizes the versioned flows. The policies of each bucket define who imports and who saves flows in it.

What is versioned

The process group

The versioned flow is a process group: local changes can be shown, reverted, or saved as a new version.

Where it stands

Version states

Up to date, Locally modified, Stale, Locally modified and stale, and Sync failure: the canvas shows whether the group is on the latest version, has changed locally, or failed to synchronize.

Why NiFi​

Guaranteed delivery

No data is lost along the way

A persistent write-ahead log and the Content Repository, together, support guaranteed delivery even at large scale.

Queues

Back pressure and prioritization

Queues hold the excess data, apply back pressure when limits are reached, and can discard data that is too old to be of value. The order in which data leaves follows configurable prioritization schemes.

Visual command

Changes take effect right away

The flow is designed and modified in the interface, in real time. A change takes effect immediately and affects only the components involved, without stopping the whole flow.

Provenance

View, download, and replay

Provenance is recorded and indexed automatically, including in splits, joins, and transformations. With the content stored, it is possible to view the data at a point in the flow, download it, and replay it from there.

Security

From the system to the user

Encrypted data exchange, such as 2-way SSL, per-component authorization for several teams on the same cluster, and sensitive properties, such as passwords, encrypted on the server.

Extension

Isolated extensions and Site-to-Site

Each extension package, a NiFi Archive (NAR), sees only its own dependencies. Between NiFi instances, data travels over the Site-to-Site protocol.

Where the ideas come from

The core concepts of NiFi are closely related to those of Flow-Based Programming: the FlowFile corresponds to the information packet, the processor to the black box that does the work, the connection to the bounded buffer between the boxes, the Flow Controller to the scheduler, and the process group to the subnet.

In the TDP editions​

Available in the TDP editions
EditionVersionDocumentation
TDP Datacenter1.28.1TDP Datacenter components
TDP Kubernetes1.28.0 · chart tdp-nifi 3.0.3Configuration in TDP Kubernetes

In TDP Datacenter​

In TDP Datacenter, NiFi and NiFi Registry are stack services, installed and managed by Ambari.

Service components

NIFI_CA (slave, optional, one instance) and NIFI_MASTER (master, one or more). The NIFI_MASTER requires ZOOKEEPER_CLIENT (ZooKeeper). Component category.

NiFi Registry

A service of its own in the stack, with a single-instance master component, which stores the versioned flows.

Coordination

The NiFi service requires ZooKeeper. The NiFi znode is defined in nifi.nifi_znode.

Repositories configurable in Ambari

The directories in nifi.flowfile.repository.dir, nifi.content.repository.dir.default, and nifi.provenance.repository.dir.default; content archiving in nifi.content.repository.archive.enabled; provenance retention in nifi.provenance.repository.max.storage.time.

Security that can be enabled

SSL on the nodes, in nifi.node.ssl.isenabled, with certificates from the NiFi Certificate Authority; the Ranger plugin for NiFi and for NiFi Registry; and Kerberos on both services; see Security in TDP Datacenter.

Processors already installed

Packages for HDFS, HBase, Hive, Iceberg, Kafka, Solr, Druid, and Livy, for lineage in Atlas, and for the NiFi Registry client. The OpenMetadata catalog can read NiFi when the integration is enabled in Ambari.

Dependencies

Ambari requires in the cluster ZooKeeper.

In TDP Kubernetes​

In TDP Kubernetes, NiFi is installed by the tdp-nifi chart and deployed by NiFiKop, an operator that maintains the NiFi cluster from a NifiCluster resource.

Operator and CRDs

NiFiKop ships in the chart itself (nifikop.enabled) and watches the namespace of the release (nifikop.watchOwnNamespace). The NiFiKop CRDs are registered beforehand, by the tdp-crds chart.

Coordination

ZooKeeper comes as a subchart and coordinates the NiFi cluster. The address is set in nifiCluster.zkAddress.

Nodes

By default, a single node. Other nodes are added as new entries in nifiCluster.nodes, each one pointing to a node configuration group.

Repositories on volumes

The FlowFile Repository, the Content Repository, and the Provenance Repository live on their own PVCs, in nifiCluster.nodeConfigGroups.default_group.storageConfigs. By default, the PVCs use reclaimPolicy: Delete. With Retain, the data survives uninstallation.

Security

Three modes: no authentication; LDAP or Active Directory authentication with the policies in NiFi itself; or with the policies in Ranger, installed by the tdp-ranger chart. The keys are nifiCluster.security.enabled, nifiCluster.security.ldap.enabled, and nifiCluster.security.authorization.mode, and the chart also offers TLS/HTTPS.

Access

By default, the NiFi service is of type NodePort. It can also be exposed through Ingress or Gateway API.

NiFi properties

Adjustments to nifi.properties go in nifiCluster.readOnlyConfig.nifiProperties.overrideConfigs.

Processors already installed

Kafka and S3 processors, the latter for object storage. See Integration with Ozone.

In both editions, the three repositories live in the storage of each node, and ZooKeeper coordinates the cluster.

In TDP Datacenter, the repository directories are service properties in Ambari. In TDP Kubernetes, each repository is a persistent volume declared in the chart.

Next steps​

Sources​

Apache NiFi - Overview

Apache NiFi - In Depth

Apache NiFi - User Guide

Apache NiFi - System Administrator's Guide

Apache NiFi Registry - User Guide