natarajan k
natarajan k

Reputation: 406

can we communicate with nifi through cli?

is there possibility through which i can communicate with nifi via command line. for instance:

  1. i want to start/stop a particular processor in processor group?
  2. i want to list the processors in the processor group?

i understand that we can do it in browser but i want to know whether we can connect with nifi and access it?

my last question, is nifi has only one canvas with flow.xml? when we have huge processors and process groups, how can we create a new flow with the separate canvas unlike the existing one?

Upvotes: 3

Views: 5486

Answers (2)

JDP10101
JDP10101

Reputation: 1852

Per olisteadman's answer, for versions 1.9.2 and later, there is a CLI as part of the the NiFi toolkit.


There is no specific Apache NiFi CLI tool but the UI is a REST service so referencing this REST API[1] you can do any command using a CLI tool like curl[2].

For #1 here is an example CURL command for starting a processor that I found here[3]:

curl 'http://localhost:8080/nifi-api/processors/2a817541-0158-1000-771e-93ca6d670429' -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' --data-binary '{"revision":{"clientId":"2a81087c-0158-1000-1362-5452a699615c","version":3},"component":{"id":"2a817541-0158-1000-771e-93ca6d670429","state":"RUNNING"}}'

For number #2 just use the api for "/process-groups/{id}" found in the docs.

Of course these commands will change depending on whether or not your NiFi instance is secured.

As for multiple canvases, there is currently no support for that but I've heard people mention it before. I'd suggest sending a DISCUSS thread to the Apache NiFi user list[4] to talk about that feature.

[1] https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

[2] https://curl.haxx.se/

[3] https://community.hortonworks.com/questions/64771/unable-to-updateexecute-processor-though-nifi-rest.html#

[4] [email protected]

Upvotes: 4

olisteadman
olisteadman

Reputation: 452

There is now a NiFi CLI (as of Jan 2018).

Some useful example commands have been captured here (by @tim-spann).

Enjoy!

enter image description here

Upvotes: 1

Related Questions