Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar
Master Guru

Automating Starting Services in Apache NiFi and Applying Parameters

Automate all the things! You can call these commands interactively or script all of them with awesome DevOps tools. @Andre Araujo and @dchaffey can tell you more about that.

Enable All NiFi Services on the Canvas

By running this three times, I get any stubborn ones or ones that needed something previously running. This could be put into a loop; check the status before trying again.

nifi pg-list
nifi pg-status
nifi pg-get-services

The NiFi CLI has interactive help available and also some good documentation:

NiFi CLI Toolkit Guide

 

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-enable-services  -u http://edge2ai-1.dim.local:8080 --processGroupId root  

 

We could then start a process group if we wanted:

 

nifi pg-start -u http://edge2ai-1.dim.local:8080 -pgid 2c1860b3-7f21-36f4-a0b8-b415c652fc62

 

List all process groups

 

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-list -u http://edge2ai-1.dim.local:8080

 

List Parameters

 

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi list-param-contexts -u http://edge2ai-1.dim.local:8080 -verbose

 

Set parameters to set parameter context for a process group; you can loop to do all.

  • pgid => parameter group id
  • pcid => parameter context id

I need to put this in a shell or Python script:

 

/opt/demo/nifi-toolkit-1.12.1/bin/cli.sh nifi pg-set-param-context -u http://edge2ai-1.dim.local:8080 -verbose -pgid 2c1860b3-7f21-36f4-a0b8-b415c652fc62  -pcid 39f0f296-0177-1000-ffff-ffffdccb6d90

 

Example

setupnifi.sh (Github Link)

You could also use the NiFi REST API or Dan's awesome Python API

NiPyApi: A Python Client SDK for Apache NiFi

References

2,015 Views
0 Kudos