Support Questions

Find answers, ask questions, and share your expertise

How do I stop a NiFi role on a single host?

avatar
Contributor

I can stop all role instances...

curl -v -k -u me:$pass -X POST "https://host.domain:7183/api/v54/clusters/cluster1/services/NIFI/roleCommands/stop" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"items\": [ \"NIFI_NODE1\", \"NIFI_NODE2\" ]}"

...but not the role on NIFI_NODE1 only. I am trying to write a script which detects that a node has disconnected, stops the role on that host, moves the flow.xml and flow.json and then restarts the role on that host.

Is there anything that lets me stop and start a role on a single host?

1 ACCEPTED SOLUTION

avatar
Master Collaborator

Hello @EFasdfSDfaSDFG 

Thank you for reaching out to Cloudera Commnuity

Yes stopping a particular role is possible. Please try the below steps

Please get the roles running on a particular host using the following endpoint

https://FQDN_CLUSTER:7183/api/v48/hosts/<host-uuid>?view=FULL

Replace host FQDN and Cluster UUID above and now copy the exact role name

For eg>> 

    "clusterName" : "Cluster 1",
    "serviceName" : "SOLR-1",
    "roleName" : "SOLR-1-SOLR_SERVER-edf000ebd88d4bc569416c779527523d",
    "healthSummary" : "CONCERNING",
    "roleStatus" : "STARTED"

Then stop using the below API

 

curl -X POST "https://<CLuster-FQND>:7183/api/v57/clusters/<Cluster-name>/services/SOLR-1/roleCommands/stop" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"items\": [ \"SOLR-1-SOLR_SERVER-edf000ebd88d4bc569416c779527523d\" ]}"

Let me know if that helps

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

View solution in original post

3 REPLIES 3

avatar
Master Collaborator

Hello @EFasdfSDfaSDFG 

Thank you for reaching out to Cloudera Commnuity

Yes stopping a particular role is possible. Please try the below steps

Please get the roles running on a particular host using the following endpoint

https://FQDN_CLUSTER:7183/api/v48/hosts/<host-uuid>?view=FULL

Replace host FQDN and Cluster UUID above and now copy the exact role name

For eg>> 

    "clusterName" : "Cluster 1",
    "serviceName" : "SOLR-1",
    "roleName" : "SOLR-1-SOLR_SERVER-edf000ebd88d4bc569416c779527523d",
    "healthSummary" : "CONCERNING",
    "roleStatus" : "STARTED"

Then stop using the below API

 

curl -X POST "https://<CLuster-FQND>:7183/api/v57/clusters/<Cluster-name>/services/SOLR-1/roleCommands/stop" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"items\": [ \"SOLR-1-SOLR_SERVER-edf000ebd88d4bc569416c779527523d\" ]}"

Let me know if that helps

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

avatar
Contributor

Thank you, that's awesome. I wasn't escaping the JSON correctly.

This works for me:

/api/v54/clusters/cluster1/services/NIFI/roleCommands/stop" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"items\": [ \"NIFI_NODE1\"]}"

avatar
Master Collaborator

@EFasdfSDfaSDFG Great, glad to know that the issue is resolved

Thanks again