Integration / Apache NiFi Interview Questions
What is State Management in NiFi and what types of state scope exist?
State Management is NiFi's built-in mechanism for processors and controller services to persistently store small amounts of key-value data that survive processor restarts and NiFi restarts. Without state management, a processor like QueryDatabaseTable would forget the last ingested timestamp every time it was stopped, causing duplicate ingestion.
State has two scopes:
Local State: Scoped to a specific processor on a specific NiFi node. Stored on local disk using LevelDB by default. Used when each node needs its own independent tracking — for example, a GetFile processor tracking which files it has processed from a local directory on that node.
Cluster State: Scoped to a specific processor but shared across all nodes in a NiFi cluster. Stored in ZooKeeper. Used when only one node should track state for the cluster — for example, QueryDatabaseTable running on the Primary Node needs its last-value state visible to whichever node becomes Primary after a failover.
State is accessed programmatically via the StateManager API. From the NiFi UI, you can view and clear a processor's state by right-clicking the processor → View State.
More Related questions...