Upgrading Apache NiFi brings security patches, performance improvements, and new features for data pipelines. Migrations also cover moves such as single node to cluster, on-prem to cloud, or side-by-side deployments. This guide shows how to plan the work, run a safe upgrade or migration, validate behavior, and roll back cleanly if needed. You will see concrete tasks, checklists, and small examples that map to real systems that often sit next to NiFi, such as Kafka, HDFS, Spark, and Airflow.
Workflow Overview
Use the following end-to-end workflow in production.
1) Assess and inventory
- Record current NiFi version, OS, and Java version.
- List custom NARs, processors, controller services, and reporting tasks.
- Capture external connectors and endpoints: Kafka topics and consumer groups, HDFS paths, HTTP endpoints, JDBC, S3, etc.
- Export or version your flows in NiFi Registry, or back up flow.xml.gz if you do not use Registry.
- Note sensitive properties key, authorizers, users, and identity providers.
Tip: keep a simple matrix of processors and controller services you rely on, so you can quickly confirm validation status in the target version.
2) Choose a strategy
- In-place upgrade (single node): simplest path; expect downtime during the window.
- Rolling upgrade (cluster): drain and upgrade one node at a time to reduce impact.
- Blue-green (side-by-side): run a new NiFi next to the old one and cut traffic over.
Choose based on your tolerance for downtime, cluster size, and how easy it is to redirect traffic (Kafka consumer groups, HTTP ingress, schedulers like Airflow).
3) Prepare and back up
- Freeze UI changes during the window.
- Back up NiFi config and data before any upgrade.
Example backup (adjust paths for your install):
export NIFI_HOME=/opt/nifi-current
export BK=/backup/nifi-$(date +%Y%m%d-%H%M%S)
mkdir -p "$BK"
# Stop NiFi
sudo systemctl stop nifi 2>/dev/null || "$NIFI_HOME"/bin/nifi.sh stop
# Back up key dirs
sudo tar -C "$NIFI_HOME" -czf "$BK"/nifi-home.tgz \
conf flowfile_repository content_repository provenance_repository state logs
# Optionally, copy off-host
# scp "$BK"/nifi-home.tgz user@backuphost:/backups/
Also capture nifi.properties separately so you can diff settings like repository locations, cluster ports, and state directories.
4) Execute the upgrade
In-place single node
- Install the new NiFi to a versioned path, e.g. /opt/nifi-NEW.
- Compare and merge conf files: nifi.properties, authorizers.xml, login-identity-providers.xml, bootstrap.conf.
- Rebuild or validate custom NARs for the new API if needed.
- Point a symlink /opt/nifi-current to the new install.
- Start and watch logs for validation and controller service issues.
Rolling cluster
- For one node at a time: drain or offload the node so it stops taking new work and its local queues empty.
- Disconnect the node from the cluster.
- Stop the service on that node; upgrade binaries and conf as above.
- Start, rejoin, and verify cluster health and balanced load.
- Repeat for the next node.
Blue-green side-by-side
- Stand up a new NiFi with the target version.
- Register to the same NiFi Registry (or import flows) and parameterize endpoints.
- Disable external sinks and sources initially; test with synthetic input.
- When validated, move traffic:
- Kafka: switch consumer groups or reassign partitions.
- HTTP: update DNS or load balancer target.
- HDFS: point writers to the new flow.
5) Validate behavior
- Enable components gradually. Prefer read-only sources and processors that do not mutate external state until you confirm correctness.
- Use a small, known dataset to verify correctness and idempotency.
- Check controller services validation status in the UI and logs.
- Watch backpressure and queue growth in key process groups.
- Confirm metrics: throughput, error counts, and latency. Inspect provenance to ensure expected event chains are present.
Validation checklist:
- No components show Invalid state.
- Custom NARs load without classpath conflicts.
- External systems like Kafka and HDFS accept connections with expected auth.
- Output schemas and filenames match contract.
6) Release and monitor
- Remove temporary throttles and backpressure limits.
- Re-enable reporting tasks and alerts.
- Monitor for at least one full business cycle or SLA window.
7) Rollback plan
- In-place: stop the new NiFi, restore the previous install and config backups, and start the old version.
- Rolling: if a node shows regressions, revert that node before proceeding to others.
- Blue-green: switch traffic back to the old environment; keep the new one disabled until fixed.
Rollback readiness signals:
- You have verified backups and can restore conf and repositories.
- Old binaries remain available, and the sensitive properties key did not change unexpectedly.
- External endpoints support a quick switch-back (DNS TTL, consumer group reassignment plan).
Local Pilot Plan
Start with a small, measurable pilot you can run locally. Keep it narrow, easy to inspect, and tied to clear success criteria.
Pilot goal
- Verify that a target NiFi version runs your key processors and controller services, and that a representative flow behaves as expected.
Test flow (example)
- Source: ConsumeKafka (test topic) or GenerateFlowFile for pure local testing.
- Transform: UpdateAttribute and JoltTransformJSON.
- Sink: PutFile to a temp directory.
Steps
- Install the target NiFi locally.
- Import or recreate the small flow. If you use NiFi Registry, pull the flow version into a local bucket.
- Parameterize endpoints (kafka.bootstrap.servers, output.dir) so you can switch between local and production values.
- Define success criteria:
- All components validate without errors.
- 1,000 test messages process under an agreed time.
- Output schema and file names match expectations.
- No errors in logs; provenance shows the expected path.
- Run the pilot and record results. If it passes, promote the same flow version to a shared dev environment and repeat with real connectors (Kafka, HDFS) under throttled load.
Why this works
- Narrow scope and measurable outcomes keep risk low and feedback fast.
Conclusion
A structured NiFi upgrade or migration comes down to clear stages: assess, choose a strategy, prepare with solid backups, execute with either in-place, rolling, or blue-green methods, validate with small datasets, and keep a rollback path ready. Begin with a local pilot that proves compatibility and performance on a small slice of your flow. From there, advance through dev, staging, and production with the same versioned artifacts and parameters. This approach reduces surprises, keeps downtime low, and helps you integrate with systems like Kafka, HDFS, Spark, and Airflow without breaking contracts.
Next checks
- Inventory is complete and backups verified.
- Custom NARs built and validated against the target version.
- Parameter contexts defined for all external endpoints.
- Rollback steps rehearsed and documented.
- Monitoring and alerting ready for post-cutover observation.