Skip to main content
JonnyL
Gold ⭐️
Aug 5, 2020 4:07 PM UTC
Solved

How do I Set Parameter Values in a NiFi instance using CLI (not Variables...)

The NiFi Toolkit CLI has a neat option for setting variables in a deployed NiFi flow. This is very useful for deploying a flow to different environments and then changing a few necessary variables. The commands are nifi pg-get-vars and nifi pg-set-var and would be used as follows;

 

#> nifi pg-get-vars -pgid 34x015f8-0284-1000-5488-a7c6511e5656 -u http://nifi-prod:8080
#> nifi pg-set-var -pgid 34x015f8-0284-1000-5488-a7c6511e5656 -var ListFilesInputDir -val /prod/temp -u http://nifi-prod:8080

However, using Parameters in  Parameter Contexts seems to be the new and better way of doing things and can be used among different groups in a flow, I have implemented many in my 140 processor project!

 

So my question is this: How do I now set different values for these Parameters for different environments when I deploy my flow. My deployment will be automated using the CLI in the NiFi toolkit, so I'm looking for a solution that is automated/scripted.

 

There appears to be ListParamContexts, GetParamContext and SetParam, but when I run;

 

nifi list-param-contexts -u http://localhost:8090/nifi

 

 

I get <title>Error 404 Not Found</title>

 

I am running NiFi-Toolkit version 1.11.4.

 

 

 

JonnyL
JonnyLAnswer
Gold ⭐️
Aug 6, 2020 8:01 AM UTC

Those are great suggestions, I'll give them a try.

I found out what was causing my <title>Error 404 Not Found</title>

 

It was the url parameter value I used

http://localhost:8090/nifi

 .. when it should have been

http://localhost:8090

The webapp name of "nifi" is not appropriate for a call via the CLI. My mistake..!

 

3 replies

JonnyL
JonnyLAuthorAnswer
Gold ⭐️
Aug 6, 2020 8:01 AM UTC

Those are great suggestions, I'll give them a try.

I found out what was causing my <title>Error 404 Not Found</title>

 

It was the url parameter value I used

http://localhost:8090/nifi

 .. when it should have been

http://localhost:8090

The webapp name of "nifi" is not appropriate for a call via the CLI. My mistake..!

 

Translate
TimothySpann
Platinum ⭐️⭐️⭐️
Platinum ⭐️⭐️⭐️
Aug 6, 2020 1:11 PM UTC

That's good news.   That's a tricky one.   Glad things are working for you.

Translate