Apache NiFi backup and recovery

Apache NiFi backup and recovery covers which files, keys, state and versioned flows to protect, what to rebuild, and how to restore a node or cluster without replaying or duplicating in-flight data.

On this page

Apache NiFi backup and recovery: what to protect after a node or cluster loss

If a NiFi node or cluster is lost or corrupted, you can only rebuild it from what you saved before the failure. The short answer is that you need a copy of the flow definition, the flow.json.gz file, a copy of nifi.properties and the other configuration files, and the sensitive key material that decrypts the values stored in them. Everything else in the running system, including queued FlowFiles, provenance and component state, is either rebuilt, replayed from source systems or accepted as lost, depending on your design. Those are different recovery roles, and treating them as one backup set is the most common reason restores go wrong.

NiFi's parts do not all recover the same way. The flow definition describes what runs. The configuration sets how each node starts, joins its cluster and talks to its identity provider. The sensitive properties key is required to read encrypted passwords inside the flow and configuration, so a flow file restored without the matching key will not start cleanly. Local state, such as processor state kept in the state directory, and the flow, content and provenance repositories hold runtime data. Most of that data is transient, so your recovery plan should say which data is replayed from upstream sources and which is simply accepted as lost. Confirm each of these choices against the NiFi System Administrator's Guide for your exact version.

Apache NiFi is Apache-2.0 software that you run in your own infrastructure, so no vendor holds the backups for you. Ownership sits with your team, and the decisions are yours to make and test. Ask your partner, or your own platform team, to confirm three things before an incident: where each backup lives, who can restore it, and how a restored node is checked against the cluster before it takes traffic. Also confirm how versioned flows in a Git repository relate to the flow file on each node, since a flow pulled from Git and a flow on disk can differ after an unrecorded change.

Which NiFi artifacts to back up and which to rebuild

A NiFi node holds a mix of durable definitions, secrets, runtime state and transient data. Some of it must be restored from a backup, some can be regenerated from code or the registry, and some should not be restored at all. Decide each artifact's category before you pick backup tooling, because the answer changes what you store, where, and who can read it.

Flow definition (flow.json.gz)

The flow.json.gz file holds the canvas: processors, connections, controller services and process group structure. NiFi 2 uses this JSON format, which the migration guidance requires when moving from flow.xml.gz. Back it up on every node or from the cluster, and keep dated copies so you can roll back a bad change. Treat it as the primary backup target, and verify that a restored copy loads on a test node before you rely on it. Versioned flows in a registry are a second source, not a replacement, because a running canvas can drift from its last committed version.

Configuration and nifi.properties

The nifi.properties file and the other configuration files under the conf directory set repository paths, cluster settings, web binding and security providers. Back them up with the same change control as the flow, since a wrong value can stop a node from starting or change where data lands. Rebuild the bootstrap and install layout from your deployment code where possible, and keep only the site-specific overrides in backup. Record which files differ from the packaged defaults so a restore does not pull in stale values.

Sensitive properties and key material

Sensitive property values and the keystore and truststore files are the artifacts most likely to block a restore and most dangerous to leak. Without the key used to protect sensitive values in the flow, encrypted parameters and passwords cannot be read after a restore. Store the key and the keystores in a secrets manager or a restricted vault, with separate access from the flow backup. Confirm the exact handling of the sensitive properties key and keystore paths in your NiFi version before you write a restore runbook.

Authorizer and login identity configuration

The authorizers.xml and login-identity-providers configuration define who can sign in and what each user, group and policy may do. Losing them can lock out administrators or grant access that was never approved. Back them up with the security configuration, and record the mapping from directory groups to NiFi policies outside the node so you can reapply it. For LDAP, OpenID Connect, SAML 2.0 and X.509 setups, keep the identity provider settings and the trust material they depend on, and test sign-in after restore.

Local and cluster state

NiFi keeps local state for components and cluster state for coordination. Cluster coordination depends on ZooKeeper, embedded or external, or on Kubernetes ConfigMaps or Leases. Local state can usually be reset when a component restarts, but some processors lose their position if it is discarded, which may cause duplicate or skipped data. Back up external ZooKeeper according to its own plan, and do not copy another node's state directory onto a rebuilt node. Confirm with each processor's documentation what happens to its state on reset.

Versioned flows in Git

Flows committed through the GitHub or GitLab Flow Registry Clients live in a Git repository, which is usually the cleanest source for rebuilding a flow on new infrastructure. Protect the repository with branch rules, backups from your Git host, and access control that matches the flow's sensitivity. Note that parameter values and secrets are not part of a flow version, so they must come from the secrets process above. NiFi Registry is deprecated and planned for removal in NiFi 3.0, so plan a migration if you still depend on it.

Content, FlowFile and provenance repositories

The content, FlowFile and provenance repositories hold in-flight data, queued pointers and event history. Do not restore them from a backup taken on another node or time, because they must match the flow state and can duplicate or drop records. Plan to rebuild the node empty, then decide how in-flight data is recovered from the source system or upstream retention. Record which records are needed for audit before any loss, because provenance is not recreated after the fact.

How backup scope changes between standalone, clustered and Kubernetes NiFi

A standalone NiFi keeps everything on one host: the flow definition, the flow configuration, the keys that protect sensitive values, and the repositories that hold FlowFiles, content and provenance. Because there is no peer to copy from, the backup set for this topology must be complete on its own. The flow file is the core artifact, and the sensitive properties key is the item most often left out, which makes stored passwords and tokens unreadable after a rebuild.

  • Flow definition: Capture flow.json.gz from the flow configuration directory, and confirm the exact path in the administration guide for your version.
  • Sensitive properties key: Store the key used to encrypt sensitive values outside the host, with access limited to the people who perform restores.
  • Configuration files: Keep nifi.properties, login and authorizer files, and the bootstrap configuration under version control or in a secured backup.
  • Repository state: Decide whether FlowFile, content and provenance repositories are backed up or accepted as loss, based on how much in-flight data you can replay from sources.
  • Certificates and truststores: Record which keystores and truststores the node uses, since a rebuilt host must present the same identity to its clients.

Confirm with your administration guide which state directories your version creates and which of them hold data you must preserve.

How to restore a NiFi node or cluster without duplicating in-flight data

This sequence brings a lost NiFi node or cluster back in a known state, with the configuration, keys and flow definition matching what ran before the loss. It also settles what happens to FlowFiles that were queued at the time of failure, so upstream data is not processed twice.

  1. Confirm the backup set and NiFi version

    Before touching the new host, confirm that the backup set came from the same NiFi version you are about to run, and that it contains the flow configuration, the configuration files, the sensitive properties key and the state directory. Check the flow file name too: NiFi 2 uses flow.json.gz, while older 1.x backups may hold flow.xml.gz, and the migration path from 1.x to 2.x is a separate change that should not be mixed into a restore. Confirm the exact version with the owner of the backup job and the release notes for that version. The step is done when someone other than the person who took the backup has signed off on the version and file list.

  2. Restore configuration and keys before first start

    Place the configuration files, including nifi.properties, the bootstrap configuration, TLS keystores and truststores, and the sensitive properties key, on the new node before NiFi starts for the first time. The sensitive properties key is the most important item in this step: without it, encrypted passwords and sensitive parameter values in the flow cannot be decrypted, and the flow will load with values that fail at runtime. Restore file ownership and permissions so the NiFi service account can read the keys but other users cannot. The step is done when the files exist at their configured paths and a checksum comparison against the backup manifest matches.

  3. Restore the flow definition or pull it from Git

    Put back the flow definition from the backup, or, if your flows are version controlled, retrieve the exact committed revision from the Git repository used by the Flow Registry Client. Record the commit identifier and the flow version so the restored state can be traced later. Where a flow is imported from Git, check that the registry client settings and any stored credentials point to the repository and branch you expect. The step is done when the flow on disk matches the recorded revision, and the commit or checksum is written into your recovery record.

  4. Start the node in isolation before rejoining

    Start the restored node with clustering disabled or with it kept away from the cluster coordination service, so it cannot take part in live flow traffic yet. Watch the startup logs for errors about missing keys, unresolved parameter contexts, controller services that fail to enable, and processors that cannot find their referenced resources. Keep source connections that feed this node paused or pointed elsewhere while it is isolated. The step is done when the node reports a clean startup, and every controller service and processor in the restored flow has been reviewed against the expected state.

  5. Verify the restored flow against the cluster

    Compare the restored flow with the state the cluster had before the loss. Check the component count, connection layout, controller service states, parameter context values (without copying secret values into tickets), and the version of the flow. If the node will rejoin a cluster, the flow it presents must match the cluster's flow, because a mismatch blocks the node from joining. Review the provenance and queue state that the cluster reports for the connections this node owned. The step is done when the diff is empty or every difference is documented and accepted by the flow owner.

  6. Decide what to do with queued FlowFiles

    FlowFiles that were sitting in queues or in the content repository when the node was lost cannot be recovered from a flow definition backup. Your options are to accept that those records were lost and re-ingest them from source, to rely on the upstream system to resend from its own checkpoint, or to read the surviving content repository if it exists on other storage. Each option has a different duplication risk. Make the decision per flow, record it, and assign an owner for any replay. Do not replay everything from the beginning of a source without first checking what downstream systems already received. The step is done when every affected flow has a written decision.

  7. Replay sources with idempotency keys or checkpoints

    Replaying data from upstream systems can duplicate records when the destination has already accepted some of them before the loss. A replay that restarts from an earlier offset will write the same events again unless the destination can detect repeats. Reduce that risk with source checkpoints that record the last confirmed offset or timestamp, and with idempotency keys on writes so that a repeated record updates instead of inserting. Confirm which of these the destination supports before you start the replay. For an illustrative case, a database writer with a unique event identifier can skip a record it has already stored, while an append-only file target cannot. The step is done when a test replay of a small window shows no duplicate rows at the destination.

  8. Rejoin the cluster and confirm steady state

    Once the node is verified, allow it to join the cluster and re-enable the source connections you paused. Watch the cluster view for the node reaching a connected state, and check that its queues drain and that back pressure does not build up on the connections it handles. Reconcile the destination counts against the source for the replay window, and record the final flow version and backup identifier in the recovery record. The step is done when the node shows as connected, the flows it handles are processing normally, and the reconciliation for the replay window is signed off.

Handling in-flight data and duplicate records after recovery

Queued FlowFiles and their content are a different recovery problem from configuration. A backup of the flow definition tells you what the dataflow should look like. It says nothing about the FlowFiles that were sitting in connection queues, being processed, or waiting in the content repository when the node failed. Those records exist in the FlowFile repository and the content repository, and their state is tied to the moment of the failure. If you restore an older copy of those repositories, NiFi will resume from that earlier state, and any FlowFile that was already delivered downstream after the backup may be delivered again. Restoring the flow file alone avoids that risk but accepts that queued data is gone.

The choice is a trade-off. Restoring the FlowFile and content repositories preserves in-flight records, but it carries more state, more duplication risk, and a tighter coupling to the exact snapshot you restore. Accepting loss and replaying from sources is simpler and avoids restoring stale state, but it only works where the source systems keep data long enough to re-read it and where the downstream systems can tolerate repeated records. Your choice depends on which sources are replayable (for example, a message broker with retained offsets, or files that remain on the source system) and whether downstream writes are idempotent, keyed on a stable identifier, or deduplicated at the destination.

Test both paths in a non-production copy before you commit to a runbook. Restore a copy of the flow file, the repositories and a recent snapshot into an isolated environment, count the records that arrive at each destination, and compare them with what the source and destination systems already hold. Then repeat the exercise with the flow file only and a replay from the source. Confirm the exact repository and state files your NiFi version uses with the NiFi administration guide and your own environment, because the layout and any retained state differ between installations.

Recovery options and when each fits

This table compares four ways to recover a NiFi deployment, from restoring everything on disk to rebuilding nodes and replaying data from upstream sources. Read each row for what it protects, what it costs in storage and restore time, and the conditions under which it fits. The main takeaway is that the more of the flow you can rebuild from Git and configuration, the less you need to copy from the repositories, but in-flight data is only protected by the repositories or by upstream replay.

OptionWhat it protectsStorage and restore timeWhen it fits
Full NiFi home and repositoriesFlow definition (flow.json.gz), nifi.properties, keys, state, FlowFile, content and provenance repositories, so queued in-flight data survivesHighest storage, since repositories can be large; restore time grows with repository size and needs a stopped nodeFlows with data in queues that cannot be re-fetched from the source, or where audit needs provenance history kept
Configuration, keys and flow definitions with Git as the flow sourceFlow design through versioned flows in a Git repository, plus configuration files, sensitive value keys and certificatesLow storage; restore is quick, but the flow still has to be deployed and in-flight data is not restoredMost production clusters where sources can replay data and the team can recreate the node from configuration
Rebuilt node with replay from upstream sourcesFlow logic and data, as far as upstream systems still hold the original records and allow re-consumptionMinimal backup storage; restore effort depends on how much upstream replay is possible and how long it takesPull-based sources that retain data, such as message brokers or APIs with cursors, where duplicates can be handled downstream
Restore to a new clusterSame logical flow and configuration applied to new hosts, useful when the original hardware or site is lostNeeds capacity for a second topology during cutover; copied artifacts must match the NiFi version and keysSite loss or platform change, provided the target runs the same NiFi version and the sensitive keys are available

How to set up a NiFi backup and recovery routine

This sequence turns a running NiFi into a recoverable system by listing what each node holds, protecting keys and sensitive values, versioning flows outside the server, automating encrypted backups, and proving the restore works in a separate environment before you need it.

  1. Inventory artifacts on every node

    Walk each node and list what it holds: the flow configuration file (flow.json.gz on NiFi 2), conf files such as nifi.properties, authorizers and login identity providers, the keystore and truststore, the sensitive properties key, bootstrap and logging configuration, custom NARs, and the content, provenance, flowfile and state repositories. Mark each item as back up, rebuild, or regenerate, and record its location. The step is done when a reviewer can point to every item on the list for every node, and when the cluster-wide items (such as the shared flow and cluster state) are identified separately from per-node items. Confirm the repository locations and file names against the NiFi System Administrator's Guide for your exact version, since layout differs between 1.x and 2.x.

  2. Move keys and sensitive values into a vault

    Identify every secret the flow depends on, including the sensitive properties key, keystore passwords, and the sensitive parameter values used by controller services and processors. Store them in a controlled secrets manager such as OpenBao or another vault your organization operates, and reference them through NiFi parameters or providers rather than plain text in the flow. Restrict who can read them and log access. Check that a copy of the sensitive properties key exists outside the NiFi host, because a flow backup without that key cannot decrypt its sensitive values. Done when you can rebuild a node's configuration from the vault alone and the key copy has been verified to decrypt a test value.

  3. Version flows in a Git-based registry

    Connect NiFi to a Git-backed Flow Registry Client, such as the GitHub or GitLab clients documented for NiFi 2, and commit each production process group as a versioned flow with its parameter contexts handled deliberately. Keep the repository under your own control with branch protection and review for changes. Flow versions give you a readable history of what the flow was, which the flow.json.gz file alone does not. Note that NiFi Registry is deprecated and planned for removal in NiFi 3.0, so avoid building a new routine that depends on it. The step is complete when a changed process group can be committed, pulled into a second environment, and shows the same version identifier.

  4. Schedule and encrypt the backups

    Schedule a job for each node that copies the configuration set and the flow configuration file, and a separate cluster-level copy of shared state where your deployment uses it. Stop or quiesce writes where the copy would otherwise capture a half-written file, or use a snapshot of the underlying volume taken at a consistent point. Encrypt the archives before they leave the host and store them in a location with separate credentials and retention rules. Content and provenance repositories are large and may be better rebuilt or accepted as loss, which is a business decision to record. Verify the job runs and that the encrypted archive can be listed and decrypted. Finish when the job log, the archive checksum and a decryption check are all recorded.

  5. Document the restore runbook

    Write a runbook covering the order of restoration: install the same NiFi version and Java runtime, restore configuration and keys, recover the flow from backup or pull it from Git, restore cluster coordination (ZooKeeper or Kubernetes state), and start nodes one at a time. Include the decisions the operator must make, such as whether in-flight data from the content repository is replayed, discarded, or reconciled with the source systems, and how to avoid duplicate writes to downstream systems for items already processed. Name the owner of each action and the evidence to collect. The runbook is finished when a second engineer who did not write it can follow it on paper and identify each check.

  6. Run a restore test in isolation

    Restore the backup into a separate environment that cannot reach production sinks or sources, using test credentials and a copy of the vault entries. Confirm that the flow loads without errors, that every controller service enables, and that restored sensitive values decrypt. Start the nodes, then confirm they join the cluster without flow mismatches and that the cluster shows the expected node count. Review queues and back pressure, and check the provenance and bulletins for errors that appeared during startup. Record which checks passed, which failed, and the time each took, then fix the runbook where it was unclear. The test is done when the isolated cluster matches the production flow version and all checks are recorded.

  7. Repeat the restore test on a schedule

    Set a recurring restore test in your change calendar and assign an owner who is not the person who built the backup job. Each run repeats the isolated restore, uses the current backup and the current runbook, and updates the record of results. Treat any new NiFi version, processor bundle, or vault change as a trigger for an extra run before it reaches production. Review the findings with the operations and security owners, and confirm that access to backups and keys is revoked for people who have left the team. The routine is working when recent test results are on file, the owner has signed them off, and the runbook matches the live configuration.

Protecting backups that contain keys and flow secrets

A NiFi backup is only as safe as the material inside it. The flow definition, sensitive property values, security configuration and certificates can each expose the systems NiFi connects to, so they need controls that match their sensitivity. The cards below cover where that material sits, how to separate it, and how to prove who touched it.

Encrypt backup media at rest

Every copy of the flow, configuration and repository data should be encrypted on the media that holds it, including disk snapshots, object storage buckets and offline tapes or drives. Encryption at rest protects the backup itself, but it does not replace the separate key handling NiFi needs for sensitive properties. Ask your team which key management service holds the backup encryption keys, who can rotate them, and whether a restore can be performed without any single administrator holding every key.

Restrict access to backup stores

Treat backup locations as privileged systems. Limit read access to the people and service accounts that perform restores, and keep write access separate so a compromised NiFi host cannot overwrite or delete its own history. Review who can list, copy or download backup objects, and confirm that deletion requires a second approval or a retention lock. Access logs from the storage platform should be retained on a different account than the one that writes backups.

Keep sensitive property keys out of flow backups

The flow.json.gz file holds the flow definition, and sensitive property values in it are encrypted with a key that NiFi reads from its own configuration. Back up the flow file and the sensitive properties key as separate items, store them in different locations, and restrict each to its own group of administrators. Confirm with your NiFi build how the key is supplied at startup, because a restore needs both pieces and losing either one leaves encrypted values unreadable.

Handle certificates and security configuration as secrets

NiFi's keystores, truststores, certificate hostnames and authentication settings are tied to the environment they were issued for. A copy restored into a different hostname, network or cluster can fail TLS or node trust checks, and a copy taken from production can expose private keys to a lower-trust environment. Store these files in a secrets manager or encrypted vault, record their issuing authority and expiry, and plan a fresh certificate issue for any restore into a new environment.

Rotate credentials after suspected compromise

If a backup store, a restore host or an administrator account may have been exposed, assume that the sensitive properties key, certificates and any credentials stored in the flow are compromised. Rotate the sensitive properties key, reissue node and user certificates, change passwords for connected systems, and then take a new backup under the new keys. Confirm with your team the order of these steps, because restoring old backups after rotation may bring back compromised values.

Audit every restore action

Record who requested a restore, which backup version was used, which host or cluster received it, and who approved it. Keep these records outside the NiFi instance being restored, so the audit trail survives the event that triggered the restore. Ask your team whether NiFi's own logs and the storage platform's access logs are both shipped to a central store, and whether a test restore is logged the same way as a production restore.

Questions teams ask before restoring or hiring help for NiFi recovery

What does a NiFi backup and recovery engagement cost?

No price list exists, and a quote follows from a written scope. The cost is driven by what must be recovered and verified: the number of nodes, how many flows are versioned, how large the repositories are, how much custom code must be rebuilt or retested, and how much compliance evidence is needed. Ask for the quote to split one-time work (designing the backup set, writing restore runbooks, running the first restore test) from recurring work (scheduled backup checks, periodic restore drills, and any retainer for support). Ask whether the quote covers the restore test in a non-production environment and what the team must supply to run it.

What drives the effort in a NiFi restore?

Effort rises with the number of nodes and whether the cluster uses an embedded or external ZooKeeper or Kubernetes state. It also rises with the number of versioned flows in a Git-backed flow registry, the size of the content and provenance repositories, the amount of custom processors or scripted components that must be rebuilt, and the evidence auditors expect. A single standalone node with one flow in Git is a much smaller job than a multi-node cluster with sensitive parameters, custom extensions and a retention requirement.

How long does a NiFi restore test take?

The duration depends on the environment, so no fixed figure applies here. Time is spent on copying backups into a test environment, starting the node or cluster, confirming that the flow loads from flow.json.gz, checking that sensitive values and keystores decrypt, and comparing the restored flow with the version in Git. Large content repositories and multi-node clusters take longer to validate. Ask for the test plan to list each step, the environment used and the pass criteria, and confirm the schedule with the team that owns your change windows.

What must our team provide for a recovery engagement?

Plan to provide access to the NiFi hosts, the cluster and the Git repository holding versioned flows, along with the backup stores that hold flow.json.gz, configuration files and key material. You also need named flow owners who can confirm which flow versions are correct, a contact who can approve change windows, and a secure channel for handling keys and passwords. Confirm in writing who can approve a restore into production, since that decision should not sit with the implementation team alone.

Can our own team restore NiFi without outside help?

Yes, if the team has Linux, JVM and NiFi administration skills and the backup set is complete. Teams usually struggle with three things: knowing which items must be backed up (the flow configuration, configuration files, keys and state versus what can be rebuilt), restoring without duplicating in-flight data, and proving the result works. Outside help is most useful for designing the backup scope, writing and rehearsing the runbook, and documenting the evidence. Ask a partner to hand over a runbook your staff can execute on their own.

Which parts of NiFi recovery are one-time and which recur?

One-time work includes inventorying what must be backed up, designing the backup and restore procedure, and running the first full restore test. Recurring work includes verifying that backups complete, repeating restore tests after upgrades (for example, moving between 1.x and 2.x changes the flow file format), updating runbooks when flows or nodes change, and keeping the Git-based flow versions current. Ask for the recurring items to be listed with an owner and a frequency, so the cost of keeping recovery ready is visible.

Does NiFi recovery help with compliance evidence?

Recovery work can prepare the records an auditor will request, such as the restore procedure, test results, flow version history and access records. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations. Ask your auditor which evidence format they expect before the restore test is run so the test produces it.

How DeployOpen scopes and delivers NiFi backup and recovery

DeployOpen approaches NiFi backup and recovery as a written, fixed-scope piece of work inside your own infrastructure. We agree what is backed up, what is rebuilt, and how a node or cluster is restored before any change is made, then test that recovery path and document it for your operators.

How we scope

  • Inventory each NiFi node, the flow.json.gz file, configuration, keys, state and the flows versioned in Git.
  • Classify every artifact as back up, rebuild or regenerate, and record the reason in the written scope.
  • Confirm your recovery objectives, storage locations, retention and who approves a restore before work starts.

How we build

  • Design the backup jobs, encryption of keys and sensitive values, and off-host storage for each NiFi deployment.
  • Write restore runbooks that stop in-flight flows first, so queued data is not replayed into duplicate outputs.
  • Test restores of a single node and a full cluster in a non-production copy, and record what was rebuilt by hand.

How we hand over

  • Deliver the backup configuration, restore runbooks, test records and a list of artifacts that must be kept outside the backup.
  • Walk your operators through a restore drill so they can run the procedure without DeployOpen present.
  • Document the assumptions behind each recovery step, including the NiFi version and the flow registry in use.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and periodic restore testing are available as a retainer after handover.
  • Ask for a quote based on your written scope, including who runs the backups, who tests restores and how often.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.