Created 09-18-2017 09:23 PM
I uploaded a template via api and delete the old template but how do I replace what is running currently. I see you can remove flow.xml but that needs a reboot. Is there any other way to replace a currently running template with a new one.
Created 09-18-2017 09:50 PM
A NiFi template is just a snippet of xml which contains a set of NiFi components (processors, input/output ports, RPG, Process Groups, connections, Controller Services, etc..). All of these components in that template have normalized UUIDs and any sensitive properties (passwords) removed.
The process of deleting and uploading a template to the canvas you have done successfully via NiFi's rest-api, but replacing the instantiated copy of the previous version of that template is complicated.
When you add a template to the canvas (instantiate the template), all the components are assigned new UUIDs. This allows you instantiate that same template multiple times on the same canvas. This means there is no way to add you newly uploaded template to the canvas and have it assume those UUIDs used by the same processors in the old templates instantiation.
The process would need to involve:
1. Make rest api calls to stop any processors that re ingesting new data in to old template instantiation.
2. Add new template version to canvas and configure any missing property values (sensitive properties)
3. If you template includes and controller services they will be duplicated as well on instantiation, so you may need to reconfigure process to point to existing controller services if you don't want this duplication.
4. Start all the processors in your new template instantiation.
5. Once all data has been processed out of your old template instantiation, delete those components from the canvas. If your template's components all fall within a process group this deletion is made a little easier. You can just delete the process group and it will delete all components within it. You will still need to know the UUID of that process group.
When scripting out your Rest-API calls, it is always easier to capture the rest-api calls being made by your browser as you perform the steps via the UI.
Created 09-19-2017 01:58 AM
I am thinking on putting everything in one process group.
This is what I am planning:
1. Delete Process Group_A. I don't care about draining right now. I can just let it go.
2. Create Process Group_B (just in case somethings are overlapping)
3. Uploaded template
4. Instantiate template
However, I see an error when trying to use delete Process Group as it says its in use: (Node 172.31.240.16:8080 is unable to fulfill this request due to: XXXXXXXXXXXXXX is running). Is there a way to forcefully remove i
Created 09-19-2017 01:49 PM
Step one will not work. Not only do all components need to be in a stopped state (with no active threads), but NiFi will not let you delete a connection if it has data queued in it. When you stop a processor any running threads will still run to completion. "stopping" a processor simply stops the processor from triggering again. You can issue a rest-api call against the Process group to stop all components inside that process group. You can issue a rest-api call against every connection to "empty queue" to make sure they are empty before trying to delete.
Created 09-19-2017 09:09 AM
Just as an additional note: there is on-going work around the NiFi Registry sub-project that will ease all of this process when released: https://nifi.apache.org/registry.html