Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop the single processor in nifi1.1.0 using rest api

Tags:

apache-nifi

I am trying to stop the processor which is in running state using the PUT method in rest api /processors/{id}.

I am able to start the processor by changing the state in the component as follows "state": "RUNNING", and runStatus in the aggregatesnapshot as "runStatus": "Running".

Similarly I tried to stop the processor by changing the state as STOPPED but facing an error as

9204b68d-0159-1000-7d8f-720592b2a2dd is not stopped (409 error conflict nd 400 Badrequest).

Please let me know how to stop the processor.

Thanks in advance.

like image 361
mRhNs13 Avatar asked Jan 18 '17 06:01

mRhNs13


People also ask

How do I use NiFi REST API?

Create the Nifi Flow. Launch Apache Nifi by running the bin/nifi.sh run command on your terminal. Note that your password must be the root directory of Nifi when you run this command. Open your browser and go to http://localhost:8080/nifi to access the Nifi UI where you can create the flow.

How do I know if NiFi is running?

To check the status and see if NiFi is currently running, execute the command bin/nifi.sh status . NiFi can be shutdown by executing the command bin/nifi.sh stop .

What is NiFi zookeeper?

zookeeper. NiFi itself does not handle voting process in cluster. This means when a cluster is created, all the nodes are primary and coordinator. So, zookeeper is configured to manage the voting of primary node and coordinator.


1 Answers

you can able to stop processor using rest api.

Example:

i having GetFile(ID:9204b68d-0159-1000-7d8f-720592b2a2dd) processor in UI.

RestAPI Url:

http://<host>:<port>/nifi-api/processors/9204b68d-0159-1000-7d8f-720592b2a2dd

Here json content i have passed as PUT Request to stop processor.

{
  "status": {
    "runStatus": "STOPPED"
  },
  "component": {
    "state": "STOPPED",
    "id": "9204b68d-0159-1000-7d8f-720592b2a2dd"
  },
  "id": "9204b68d-0159-1000-7d8f-720592b2a2dd",
  "revision": {
    "version": 10,
    "clientId": "ab010dd6-0159-1000-615b-f095502a7ceb"
  }
} 

Revision and Status are most important things in stop the processor from RestAPI.

It works well for me.Try it.

And let me know if not worked.

like image 59
Mister X Avatar answered Oct 13 '22 10:10

Mister X