Graceful shutdown
You can configure the graceful shutdown as described in Graceful shutdown.
Nodes
As a default, NiFi nodes have 5 minutes to shut down gracefully.
The NiFi node process receives a SIGTERM signal when Kubernetes wants to terminate the Pod.
It logs the received signal as shown in the log below and initiate a graceful shutdown.
After the graceful shutdown timeout runs out, and the process still did not exit, Kubernetes issues a SIGKILL signal.
nifi NiFi PID [43] shutdown started
nifi NiFi PID [43] shutdown in progress...
[...]
nifi 2023-11-08 10:52:14,459 INFO [pool-1-thread-1] org.apache.nifi.NiFi Application Server shutdown completed
nifi 2023-11-08 10:52:15,139 INFO [Thread-0] org.apache.nifi.NiFi Application Server shutdown started
nifi 2023-11-08 10:52:15,139 INFO [Thread-0] org.apache.nifi.nar.NarAutoLoader NAR Auto-Loader stopped
nifi 2023-11-08 10:52:15,139 INFO [Thread-0] o.a.n.f.r.CompositeExternalResourceProviderService External Resource Provider Service is stopped
nifi 2023-11-08 10:52:15,139 INFO [Thread-0] org.apache.nifi.NiFi Application Server shutdown completed
For high-throughput clusters (large numbers of in-flight FlowFiles or high provenance event rates), 5 minutes may not be enough time for NiFi to flush the FlowFile write-ahead log and finalize the provenance index.
If SIGKILL is consistently reached before NiFi can shut down cleanly, repositories are left in a partially-flushed state, which makes the next startup significantly slower (FlowFile WAL recovery and provenance reindex have more work to do).
Increase gracefulShutdownTimeout if you observe SIGKILL being issued, or if subsequent restarts take noticeably longer than expected.
|