Created 06-07-2023 02:49 AM
Hi All,
I am running Nifi on a single Development server. (NAME="Debian GNU/Linux" VERSION_ID="10")
I start the service using command line - bin/nifi.sh start
During the initial phases as i experiment with RAM, CPU and disk i need to restart machine sometimes.
When machine restarted I use above command to start Nifi and I go to UI and start the jobs.
Is there a way that
1. Nifi process starts automatically when ever system reboots or restarts ?
2. Nifi jobs also start automatically without me running from UI ?
can I use startup scripts for this ?
I want to get ready with production mindset as i soon will be launching.
I want to understand how it is handled in realtime production servers..
Please suggest.
Created 06-07-2023 07:51 AM
@SandyClouds You can make nifi run as a service, then add that to startup services. This will ensure that nifi is always running after system reboots.
https://nifi.apache.org/docs/nifi-docs/html/getting-started.html#installing-as-a-service
Currently, installing NiFi as a service is supported only for Linux and macOS users. To install the application as a service, navigate to the installation directory in a Terminal window and execute the command bin/nifi.sh install to install the service with the default name nifi. To specify a custom name for the service, execute the command with an optional second argument that is the name of the service. For example, to install NiFi as a service with the name dataflow, use the command bin/nifi.sh install dataflow.
Once installed, the service can be started and stopped using the appropriate commands, such as sudo service nifi start and sudo service nifi stop. Additionally, the running status can be checked via sudo service nifi status.
Stopping or starting flows or other actions against flows would need to be done with command line or nifi rest api.
Created 06-07-2023 12:32 PM
@SandyClouds
@steven-matison response if perfect.
Just to add to your second question "2. NiFi jobs also start automatically without me running from UI ?"
NiFi is really designed as an always on data in motion service. NiFi preserves the state (stopped, started, enabled, disabled) of all its components in the flow.json.gz file. On startup of the service, NiFi will load the flow.json.gz, load FlowFiles form the NiFi Repository back in to connection within your dataflow, and return all components to last known state. There is a property in the nifi.properties file "nifi.flowcontroller.autoResumeState=true" that controls this behavior. If you change it from default "true" to "false", NiFi will reset all components to stopped (processors) or disabled (controller services and reporting tasks) on startup.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
Created 06-07-2023 07:51 AM
@SandyClouds You can make nifi run as a service, then add that to startup services. This will ensure that nifi is always running after system reboots.
https://nifi.apache.org/docs/nifi-docs/html/getting-started.html#installing-as-a-service
Currently, installing NiFi as a service is supported only for Linux and macOS users. To install the application as a service, navigate to the installation directory in a Terminal window and execute the command bin/nifi.sh install to install the service with the default name nifi. To specify a custom name for the service, execute the command with an optional second argument that is the name of the service. For example, to install NiFi as a service with the name dataflow, use the command bin/nifi.sh install dataflow.
Once installed, the service can be started and stopped using the appropriate commands, such as sudo service nifi start and sudo service nifi stop. Additionally, the running status can be checked via sudo service nifi status.
Stopping or starting flows or other actions against flows would need to be done with command line or nifi rest api.
Created 06-07-2023 12:32 PM
@SandyClouds
@steven-matison response if perfect.
Just to add to your second question "2. NiFi jobs also start automatically without me running from UI ?"
NiFi is really designed as an always on data in motion service. NiFi preserves the state (stopped, started, enabled, disabled) of all its components in the flow.json.gz file. On startup of the service, NiFi will load the flow.json.gz, load FlowFiles form the NiFi Repository back in to connection within your dataflow, and return all components to last known state. There is a property in the nifi.properties file "nifi.flowcontroller.autoResumeState=true" that controls this behavior. If you change it from default "true" to "false", NiFi will reset all components to stopped (processors) or disabled (controller services and reporting tasks) on startup.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
Created 06-08-2023 02:11 AM
@MattWho Thanks much for clearing my confusions around on - how my jobs running automatically when i restart server.. I encountered restart couple of times but never know this feature. You are awesome!!