Intro
Running Apache NiFi in production is about reliability, safety, and speed of change. This checklist turns best practices into concrete actions across configuration, security, monitoring, maintenance, backups, upgrades, and common pitfalls. Each item is paired with practical examples and ready-to-use settings so you can apply them today.
Workflow Overview
A clear, repeatable flow from idea to production reduces risk and rework.
- Plan: define the data sources, sinks, SLAs, and failure modes.
- Build locally: implement a minimal flow with Parameter Contexts and Controller Services.
- Version: use NiFi Registry for flow versioning.
- Test: validate functional paths, backpressure, and error handling.
- Stage: deploy to a non-prod cluster mirroring production limits.
- Release: promote to production with change notes and rollback steps.
- Operate: monitor health, throughput, latency, and errors.
- Improve: gather metrics, tune thresholds, and retire unused components.
Configuration and Hardening
Core settings to lock down and tune:
Security
- Enable HTTPS in nifi.properties and use strong TLS:
- nifi.web.https.host=0.0.0.0
- nifi.web.https.port=8443
- nifi.security.keystore=./conf/keystore.jks
- nifi.security.keystoreType=JKS
- nifi.security.keystorePasswd=changeit
- nifi.security.truststore=./conf/truststore.jks
- nifi.security.truststoreType=JKS
- nifi.security.truststorePasswd=changeit
- Configure users and groups, and grant least-privilege policies.
- Store secrets in Parameter Contexts. Avoid hardcoding credentials in processors.
Repositories and retention
- Place flowfile_repository, content_repository, and provenance_repository on fast, separate disks.
- Set provenance retention to balance auditability with disk:
- nifi.provenance.repository.max.storage.time=24 hours
- nifi.provenance.repository.max.storage.size=50 GB
- Ensure content repo has headroom (e.g., keep <70% usage under peak).
Flow performance and safety
- Apply backpressure on every connection. Example: 20000 objects or 5 GB.
- Set penalization and yield to protect sources when downstream is slow.
- Prefer stateless patterns where possible; keep queues short.
Scheduling and resources
- In bootstrap.conf, size the JVM conservatively and predictably:
- java.arg.2=-Xms8g
- java.arg.3=-Xmx8g
- Right-size concurrent tasks per processor based on CPU and IO.
- Use Run Schedule and Run Duration to avoid CPU thrash on lightweight processors.
Controller Services
- Centralize shared configs (DBCPConnectionPool, SSLContextService, etc.).
- Validate services first, then enable processors to avoid partial starts.
Monitoring and Alerting
What to watch and how to wire it:
Key health signals
- Node health: CPU, heap, GC, disk usage per repo.
- Flow health: queued count/size vs backpressure thresholds, bulletin frequency, error relationships.
- SLA indicators: end-to-end latency, throughput per path, success vs failure ratios.
NiFi-native tools
- Status History: track component-level metrics over time.
- Bulletins: surface processor warnings and errors quickly.
- ReportingTasks: emit metrics and bulletins to your monitoring stack.
- MonitorActivity processors: detect upstream stalls and raise alerts.
Alert rules (examples)
- Queue growth rate exceeds X% for Y minutes on critical paths.
- Bulletin with ERROR repeats > N times in 5 minutes.
- Provenance event gap indicates missing data for a source.
- Content repo or provenance repo disk > 80%.
Runbooks
- For each alert, document triage steps: identify affected processors, pause ingest, drain or reroute, roll back to last known good version, validate recovery.
Maintenance
Keep the cluster healthy with a light but consistent routine:
Daily
- Review bulletins and error relationships on key process groups.
- Check repo disk usage and largest queues.
- Verify ReportingTasks are running and up to date.
Weekly
- Tune backpressure thresholds if queues tend to saturate.
- Rotate and archive logs; confirm logback size and retention policies.
- Validate Controller Services and remove unused ones.
Monthly
- Review provenance retention and adjust size/time caps.
- Cleanup disabled or abandoned processors and connections.
- Exercise restore-from-backup in a sandbox.
Quarterly
- Capacity review: CPU, heap, disk for growth trends.
- Dependency audit: custom NARs, drivers, and external endpoints.
- Chaos drills: simulate a node loss and a repo disk fill-up.
Backups and Recovery
Back up what you need to restore operations, not transient data.
What to back up
- conf/ (including nifi.properties, authorizers, users, logback)
- flow.json.gz (the running dataflow)
- state/ (local and cluster state)
- Custom NARs and drivers (e.g., lib/ extensions)
- NiFi Registry data (backup from its storage backend)
Recommended process (single node)
- Stop NiFi cleanly.
- Copy conf/, flow.json.gz, and state/ to a versioned, off-host location.
- Copy custom NARs and drivers.
- Restart and verify.
Recommended process (cluster)
- Offload or drain each node before maintenance to minimize data at rest.
- Back up each node as above plus cluster-wide resources.
- Keep backups for at least one full upgrade cycle.
Disaster recovery notes
- Repositories (flowfile, content, provenance) can be very large; prefer redeploying flows and reprocessing from sources (e.g., Kafka) over restoring repos.
- Keep NiFi Registry authoritative for flow versions to speed redeploy.
- Document cold-start steps per flow: how to pick up from last checkpoint or offset.
Upgrades and Change Management
Lower risk with staged, reversible changes.
Change hygiene
- Version every process group with NiFi Registry.
- Write change notes: purpose, risk, expected metrics deltas, rollback.
- Use Parameter Contexts to isolate environment differences.
Single-node upgrade
- Backup: conf/, flow.json.gz, state/, and custom NARs.
- Stop NiFi. Install the new version side by side.
- Copy forward configs and extensions; reconcile diffs in nifi.properties and bootstrap.conf.
- Start, validate logs and UI, run a smoke test flow.
Rolling upgrade (cluster)
- Disconnect and offload a node to drain work.
- Upgrade that node, validate, then rejoin.
- Repeat node by node to keep the cluster serving.
Post-upgrade
- Verify Controller Services compatibility and processor deprecations.
- Watch GC, throughput, and queue profiles for 24-48 hours.
- Keep the previous version ready for rollback until stable.
Common Production Pitfalls
Avoid these costly mistakes:
- No backpressure on connections: leads to memory pressure and instability.
- Oversized, long-lived queues: hide problems and slow recovery.
- Unbounded retries: hot loops that hammer downstream systems.
- Secrets in processor properties: move to secure Parameter Contexts.
- Single-thread everywhere: underutilizes resources; size concurrency per path.
- Missing provenance retention: blocks root-cause analysis.
- Skipping staging: changes jump straight to prod and cause outages.
- Ignoring disk IO: placing all repos on the same slow volume.
- No runbooks: alerts fire but response is ad hoc and slow.
Practical Examples
Example 1: Kafka to HDFS with safe backpressure
- Processors: ConsumeKafka, UpdateAttribute, PutHDFS, LogAttribute (fail path)
- Connection thresholds: 20000 objects or 5 GB between each step
- Failure handling: route failure to a Dead Letter Queue process group with a PutFile sink, capturing kafka.topic, partition, offset
- Tuning: PutHDFS concurrent tasks = number of HDFS client cores available; Run Schedule 0 sec for streaming, 1-2 sec if small files cause churn
- SLA checks: MonitorActivity on ConsumeKafka and a queue growth alert after PutHDFS
Example 2: REST pull with rate limits and retries
- Processors: GenerateTableFetch or InvokeHTTP, EvaluateJsonPath, PutDatabaseRecord
- Rate limit: Use ControlRate before InvokeHTTP (e.g., 100 req/min)
- Retry pattern: Route 5xx to a retry queue with penalization and backoff; route 4xx to a Dead Letter Queue with context attributes
- Observability: Log status.code and response.time; set an alert on 5xx ratio > 2% for 10 minutes
Example 3: Batch window with checkpointing
- Processors: ListFile -> FetchFile -> PutHDFS
- Idempotency: Track seen filenames in DistributedMapCache to prevent duplicates
- Windowing: Schedule ListFile to run every 5 minutes; downstream runs continuously
- Recovery: If crash occurs, re-list checks cache and only fetches unseen files
Local Pilot Plan
Start small, measurable, and locally inspectable.
Goal
- Prove throughput and error handling on a single-path flow that mimics production IO patterns.
Scope
- A local file ingest to a local directory sink with one transformation step and clear backpressure.
Steps
- Create a process group with GenerateFlowFile -> UpdateAttribute -> PutFile.
- Add Parameter Context for file paths and environment toggles.
- Set connection backpressure to 1000 objects or 500 MB.
- Add MonitorActivity after GenerateFlowFile.
- Define acceptance criteria: sustain 5,000 msgs/min for 15 min, 0 errors, queue < 60% of threshold.
- Run locally, collect Status History screenshots and logs.
- If stable, port to staging by switching Parameter Contexts; keep the same thresholds.
Exit
- Promote pattern to production paths after meeting criteria.
Conclusion
Production NiFi success comes from a clear checklist, disciplined separation of steps, and small, measurable pilots. Harden the platform, observe it relentlessly, maintain it on a cadence, back up what matters, and change it safely. Use the examples and settings here to bootstrap your own runbooks and standards, then iterate based on the metrics you gather.