Intro
Apache NiFi moves data reliably when everything is healthy, but real systems face port conflicts, queue backpressure, JVM memory pressure, misconfigured SSL, and cluster instability. This guide gives you practical diagnostics, what to look for in NiFi logs, safe commands you can run, and step-by-step recovery workflows. It is written for developers, DevOps consultants, and technical startup teams who run NiFi alongside Kafka, HDFS, Spark, Airflow, and other data pipeline tools.
What you will get:
- A repeatable troubleshooting method you can apply under pressure
- Concrete examples of common NiFi failures and how to fix them
- Safe commands and file paths that matter in production
- A small, measurable pilot you can run locally before touching production
Workflow Overview
Use this sequence as your default playbook. It shortens time-to-fix and avoids risky changes.
- Triage fast
- Symptom: cannot start, UI unreachable, queues growing, errors on processors, node disconnected, or data loss concerns.
- Do not restart yet. Capture status and evidence first.
- Snapshot state safely
- Get NiFi status:
bin/nifi.sh status
- Snapshot logs and flow config:
mkdir -p snapshots && \
cp logs/nifi-*.log snapshots/ && \
cp conf/nifi.properties snapshots/ && \
cp conf/flow.xml.gz snapshots/ 2>/dev/null || true && \
cp conf/flow.json.gz snapshots/ 2>/dev/null || true
- Inspect the right logs
- Startup problems: logs/nifi-bootstrap.log
- Runtime and processor errors: logs/nifi-app.log
- User and access events: logs/nifi-user.log
- Quick grep patterns:
grep -iE "exception|error|outofmemory|bind|zookeeper|ssl|trust|keystore|backpressure" logs/nifi-app.log | tail -n 200
tail -n 200 logs/nifi-bootstrap.log
- Verify configuration hotspots
- conf/nifi.properties:
- Web port: nifi.web.http.port or nifi.web.https.port
- SSL: nifi.security.* (keystore, truststore, types, passwords)
- Repos: nifi.content.repository.directory, nifi.provenance.repository.directory, nifi.flowfile.repository.directory
- Cluster: nifi.cluster.is.node, nifi.zookeeper.connect.string
- JVM heap: conf/bootstrap.conf (Xms/Xmx lines)
- Check external dependencies and the host
- Ports in use:
lsof -i -P -n | grep -E "LISTEN|:8080|:8443" | sort -u
- Disk space and inode pressure:
df -h; df -i
du -sh content_repository/* 2>/dev/null | sort -h | tail -n 20
du -sh provenance_repository/* 2>/dev/null | sort -h | tail -n 20
- Network reachability to Kafka, HDFS, etc. (example):
nc -vz your-kafka-broker 9092
- Remediate common patterns (see cookbook below)
- Validate the fix
- NiFi REST health:
curl -s http://localhost:8080/nifi-api/flow/status | jq '.controllerStatus' 2>/dev/null || true
- UI bulletins are clear, queues drain, error counts drop, and data provenance shows healthy lineage.
- Prevent recurrence
- Tune backpressure, batch sizes, and concurrency
- Increase heap if required and revisit repo retention
- Add alerts for queue depth, error bulletins, disk usage
Common failure cookbook with practical examples
- Startup fails: Address already in use
- Symptom: UI never comes up; bootstrap log shows:
BindException: Address already in use - Diagnose:
grep -i bind logs/nifi-bootstrap.log | tail -n 50
lsof -i :8080 -sTCP:LISTEN -n -P
- Fix: change the port in conf/nifi.properties (nifi.web.http.port or nifi.web.https.port) to a free port, or stop the conflicting service.
- Safe restart:
bin/nifi.sh stop && sleep 5 && bin/nifi.sh start
bin/nifi.sh status
- Heap exhaustion: java.lang.OutOfMemoryError
- Symptom: nifi-app.log shows
OutOfMemoryErroror frequent GC pauses; UI sluggish. - Diagnose:
grep -i outofmemory logs/nifi-app.log | tail -n 50
- Fix: raise Xms/Xmx in conf/bootstrap.conf (for example, from 2g to 4g) and reduce per-transaction sizes or parallelism on heavy processors. Ensure the host has headroom.
- Example bootstrap.conf edits:
java.arg.2=-Xms4g
java.arg.3=-Xmx4g
- Prevent: enable backpressure on hot connections and right-size batch sizes.
- Queues stuck and backpressure
- Symptom: connection shows backpressure reached; upstream processors yield; error bulletins on sinks like PutKafka or PutHDFS.
- Diagnose:
- In the UI, open the connection details. Check object and size thresholds.
- In logs, look for repeated processor errors.
grep -iE "backpressure|penalized|failed to send" logs/nifi-app.log | tail -n 200
- Fix:
- Increase downstream capacity: raise concurrent tasks, add more partitions or consumer threads where applicable.
- Lower upstream batch size or add a prioritizer.
- As a last resort, drop non-critical FlowFiles from the congested connection (UI: List queue -> select -> Drop). Always confirm data retention and SLAs first.
- NAR or classpath conflicts
- Symptom: processor cannot enable;
ClassNotFoundExceptionorNoSuchMethodErrorin nifi-app.log. - Diagnose:
grep -iE "classnotfound|nosuchmethod|nar" logs/nifi-app.log | tail -n 200
- Fix:
- Remove the conflicting NAR from lib or extensions.
- Clear NiFi work dirs and restart:
bin/nifi.sh stop
rm -rf work/nar/ work/jetty/
bin/nifi.sh start
- SSL or auth failures
- Symptom:
javax.net.ssl.SSLHandshakeException,CertificateExpiredException, or login failures. - Diagnose:
grep -iE "ssl|handshake|certificate|truststore|keystore" logs/nifi-app.log | tail -n 200
- Fix:
- Verify keystore/truststore paths and passwords in conf/nifi.properties.
- Check certificate expiry:
openssl x509 -in server.crt -noout -dates
- If needed, rotate certs and update trust relationships before restart.
- Cluster node disconnects
- Symptom: node shows Disconnected; logs mention heartbeat or ZooKeeper issues.
- Diagnose:
grep -iE "disconnected|heartbeat|zookeeper|session" logs/nifi-app.log | tail -n 200
- Fix:
- Validate nifi.zookeeper.connect.string and ZooKeeper health.
- Ensure clocks are in sync and network latency is stable.
- If a node is corrupt or far behind, stop it, clear work/ and repos only as a last resort after backups, then rejoin the cluster.
- Disk full in repositories
- Symptom: processors penalized; provenance writes failing; app log notes I/O errors.
- Diagnose:
df -h; du -sh content_repository/* provenance_repository/* 2>/dev/null | sort -h | tail -n 20
- Fix:
- Free space or move repositories to larger volumes by editing conf/nifi.properties (plan a maintenance window).
- Lower provenance retention (storage size or event count) and increase purge frequency.
Safe commands and quick references
Use these from the NiFi installation directory.
Service control and status:
bin/nifi.sh status
bin/nifi.sh start
bin/nifi.sh stop
Tail logs:
tail -f logs/nifi-app.log
Check ports:
lsof -i -P -n | grep LISTEN | grep -E ":8080|:8443"
Backup critical configs:
cp conf/nifi.properties conf/nifi.properties.bak.$(date +%s)
cp conf/flow.xml.gz conf/flow.xml.gz.bak.$(date +%s) 2>/dev/null || true
cp conf/flow.json.gz conf/flow.json.gz.bak.$(date +%s) 2>/dev/null || true
Selected REST endpoints (HTTP example):
curl -s http://localhost:8080/nifi-api/flow/status | jq 2>/dev/null || true
curl -s http://localhost:8080/nifi-api/system-diagnostics | jq 2>/dev/null || true
Step-by-step recovery workflows
Scenario A: NiFi will not start due to port conflict
- Confirm failure and port usage
tail -n 100 logs/nifi-bootstrap.log
lsof -i :8080 -sTCP:LISTEN -n -P
- Choose a free port and update conf/nifi.properties
- Set nifi.web.http.port=8082 (example)
- Restart and verify
bin/nifi.sh stop && sleep 5 && bin/nifi.sh start
bin/nifi.sh status
curl -s http://localhost:8082/nifi/ >/dev/null && echo OK
Scenario B: Queue jam with PutKafka failures
- Identify the congested connection and failing processor in the UI; capture bulletins.
- Check error details in logs
grep -iE "kafka|timeout|backpressure|broker" logs/nifi-app.log | tail -n 200
- Reduce incoming rate or batch size upstream; raise concurrent tasks on PutKafka; confirm broker reachability
nc -vz your-kafka-broker 9092
- If necessary, drop non-critical FlowFiles after stakeholder approval.
- Validate: queue depth decreases, Send rate stable, no new errors for 15+ minutes.
Scenario C: Cluster node disconnected
- Inspect logs on the affected node
grep -iE "disconnected|heartbeat|zookeeper|auth" logs/nifi-app.log | tail -n 200
- Validate nifi.zookeeper.connect.string and network path. Ensure time sync.
- Restart the node if transient. If persistent, stop NiFi, clear work/nar and work/jetty, and start again
bin/nifi.sh stop
rm -rf work/nar/ work/jetty/
bin/nifi.sh start
- Verify the node rejoins and flows are in sync.
Local Pilot Plan
Goal: practice diagnosis and recovery on a tiny, isolated flow you can run on your laptop. Keep it narrow, measurable, and easy to inspect locally before any production change.
- Build a tiny flow
- GenerateFlowFile -> UpdateAttribute -> LogAttribute
- Add a branch: UpdateAttribute -> PutFile to a temp directory
- Create safe failures on purpose
- Port conflict: set nifi.web.http.port to a used port, try to start, then fix it
- Backpressure: set a connection backpressure object threshold to 10, then send 100 test FlowFiles
- File sink error: point PutFile to a non-writable directory to trigger bulletins
- Practice the workflow
- Capture status and logs, grep for errors, apply the cookbook fixes, and re-verify
- Define success signals
- Mean time to diagnose under 5 minutes
- No data loss for the LogAttribute branch
- Clear bulletins and draining queues within 10 minutes after fix
- Checklist for moving beyond local
- Back up conf and flow before any change
- Document ports, repos, JVM heap, and external endpoints
- Run the same steps on a staging NiFi with representative load
Conclusion
Troubleshooting NiFi becomes predictable when you use a simple flow: triage, snapshot, inspect logs, verify configuration and dependencies, apply known fixes, and validate. Start with a small local pilot to build muscle memory, then carry the same steps into staging and production. Keep an eye on the usual suspects: ports, SSL settings, JVM heap, repository capacity, and downstream systems like Kafka and HDFS. With safe commands, clear log patterns, and step-by-step recovery workflows, you can restore flow health quickly and prevent repeat incidents.