Created 03-03-2016 05:31 PM
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{ "RequestInfo":{ "context":"Recommission DataNodes", "command":"RECOMMISSION", "parameters":{ "slave_type":"DATANODE", "included_hosts":"c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" }, "operation_level":{ "level":"HOST_COMPONENT", "cluster_name":"c1" } }, "Requests/resource_filters":[ { "service_name":"HDFS", "component_name":"NAMENODE" } ] }' http://localhost:8080/api/v1/clusters/c1/requests
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{ "RequestInfo":{ "context":"Recommission NodeManagers", "command":"RECOMMISSION", "parameters":{ "slave_type":"NODEMANAGER", "included_hosts":"c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" }, "operation_level":{ "level":"HOST_COMPONENT", "cluster_name":"c1" } }, "Requests/resource_filters":[ { "service_name":"YARN", "component_name":"RESOURCEMANAGER" } ] }' http://localhost:8080/api/v1/clusters/c1/requests
@Artem Ervits .Can i use like this to recommission the data node and nodemanagers? Whcih one has to be excuted first? Datanodes ?
Created 03-03-2016 07:20 PM
You are becoming an advanced user of Ambari API. Your use case is definitely valid but i dont have an answer for exact steps or whether its even possible. What you can do is setup network capture with wireshark and see api calls ambari makes when you recommission a node. My guess is that that option is not available in API as you typically comission a node as part of adding a new node. So maybe as a workaround you would want to delete a node completely from cluster after decommissioning and then just add new node. Let us know if you do run netcapture.
Created 03-03-2016 07:20 PM
You are becoming an advanced user of Ambari API. Your use case is definitely valid but i dont have an answer for exact steps or whether its even possible. What you can do is setup network capture with wireshark and see api calls ambari makes when you recommission a node. My guess is that that option is not available in API as you typically comission a node as part of adding a new node. So maybe as a workaround you would want to delete a node completely from cluster after decommissioning and then just add new node. Let us know if you do run netcapture.
Created 03-03-2016 07:33 PM
Thank you @Artem Ervits I would like to give a try with the above curl commands, will post the result.
Created 03-03-2016 07:48 PM
Surprise us 🙂
Created 03-03-2016 08:04 PM
@Artem Ervits Mostly, it wouldn't work because i didn't see any dfs.include and yarn.include parameters in configurations. 🙂
Created 03-03-2016 08:20 PM
Well then decommission, delete, add node is the way to go.
Created 03-04-2016 02:29 PM
@Artem Ervits I tried to recommission by using above curl command. I got the following error..
"status" : 500, "message" : "An internal system exception occurred: Unsupported action RECOMMISSION for Service: YARN and Component: RESOURCEMANAGER"
Created 03-09-2016 02:11 PM
@Artem Ervits I am still wondering, whatever we will do through ambari, we can do them through REST api right? Why REST api is having limitiation for RECOMMISSION? Is there any theoretical reason?
Created 03-09-2016 02:13 PM
@Ram D I say look at the source code, https://github.com/apache/ambari/blob/966f3031d50b0106dfe5d19abbdd1e3b84d1f059/ambari-server/src/mai...
Created 08-17-2016 06:42 PM
Just to follow up on this one. You can recomission DataNodes and NodeManagers with the following calls. Replace the variables as needed. You may need to remove the line breaks.
Node Manager
curl -u admin:admin -H 'X-Requested-By:ambari' -X POST -d '{ "RequestInfo":{ "context":"Recomissioning of host '$host': Recomission NodeManger via REST-API", "operation_level":{ "level":"HOST", "cluster_name":"'$clustername'", "host_name":"'$host'" }, "command":"DECOMMISSION", "parameters":{ "slave_type":"NODEMANAGER", "included_hosts":"'$host'" } }, "Requests/resource_filters":[ { "service_name":"YARN", "component_name":"RESOURCEMANAGER" } ] }' "http://$ambariHost:8080/api/v1/clusters/$clustername/requests"
DataNode:
curl -u admin:admin -H 'X-Requested-By:ambari' -X POST -d '{ "RequestInfo":{ "context":"Scipt-based Recomissioning of host '$host': Recomission DataNode via REST-API", "operation_level":{ "level":"HOST", "cluster_name":"'$clustername'", "host_name":"'$host'" }, "command":"DECOMMISSION", "parameters":{ "slave_type":"DATANODE", "included_hosts":"'$host'" } }, "Requests/resource_filters":[ { "service_name":"HDFS", "component_name":"NAMENODE" } ] }' "http://$ambariHost:8080/api/v1/clusters/$clustername/requests"