Support Questions

Find answers, ask questions, and share your expertise

Apache Nifi: Start/Stop group processor from command line

avatar
Rising Star

hi guys,

Is there any ways to Start/Stop group processor from command line in Apache Nifi:

Many thanks

1 ACCEPTED SOLUTION

avatar
Master Guru

@Thuy Le

Yes by using NiFi RestAPI we can start and stop processor groups from command line.

RestAPI commands:

Start the processor group

curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"<processor_group_id>","state":"RUNNING"}' http://<nifi_url>/nifi-api/flow/process-groups/<processor_group_id>;

Stop the processor group:

curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"<processor_group_id>","state":"STOPPED"}' http://<nifi_url>/nifi-api/flow/process-groups/<processor_group_id>;

Refer to this and this links for more details regards to Start/Stop of processor groups.

-

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

4 REPLIES 4

avatar
Master Guru

@Thuy Le

Yes by using NiFi RestAPI we can start and stop processor groups from command line.

RestAPI commands:

Start the processor group

curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"<processor_group_id>","state":"RUNNING"}' http://<nifi_url>/nifi-api/flow/process-groups/<processor_group_id>;

Stop the processor group:

curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"<processor_group_id>","state":"STOPPED"}' http://<nifi_url>/nifi-api/flow/process-groups/<processor_group_id>;

Refer to this and this links for more details regards to Start/Stop of processor groups.

-

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

avatar
Expert Contributor

Hi Friends 

 

I tried running the curl from my Linux session on which Nifi installed. This is a secured nifi instance . I got the forbidden error. Please see the error below 

 

-bash-4.2$ curl -i -X PUT -H 'Content-Type: application/json' -d '{"id":"e3d11d1d-327b-1b5b-96a7-3cb59c48df17","state":"RUNNING"}' https://XXXXX:8443/nifi//nifi-api/flow/process-groups/e3d11d1d-327b-1b5b-96a7-3cb59c48df17;
HTTP/1.1 403 Forbidden
Server: squid/3.5.20
Mime-Version: 1.0
Date: Tue, 07 Jul 2020 09:34:57 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3347
X-Squid-Error: ERR_ACCESS_DENIED 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from XXXXX
X-Cache-Lookup: NONE from XXXX
Via: 1.1 XXXXXsquid/3.5.20)
Connection: keep-alive

curl: (56) Received HTTP code 403 from proxy after CONNECT

 

@Shu_ashu - can you please help me here sir. Is it that I need to specify the certs somewhere ?

avatar
Rising Star

Hi @Shu,

Thank you so much. It works well for one group. Is it possible to start/stop multiple/all group processors

avatar
Master Guru

@Thuy Le

I dont think its possible in one call.

For more debugging for this case use chrome/firefox developer tools and check the calls that are making while doing this action from UI.

If we select two processor groups and hit start button then there are two put methods are running in the back ground to start the process groups.