Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How can i recommission Node managers and Data nodes through REST API?

Solved Go to solution
Highlighted

Re: How can i recommission Node managers and Data nodes through REST API?

Explorer

Thank you very much @Roland Simonis

I had the same problem (reinstalled a slave from scratch, and decommisioned via Ambari both DN and NM) but Ambari doesn't have a GUI option for recommissioning the NM, so the ResourceManager was always denying access. With the API call you posted I easily recommissioned the NM and now everything is working again as expected.

Thanks!

Re: How can i recommission Node managers and Data nodes through REST API?

New Contributor

In ambari version AMBARI-2.5.1.7 we needed to do another step after recommissioning steps above mentioned. The nodemanger was going to stopped state after the recommissioning call. Needed to change the state from installed to started.

curl -u user:pass -i -H 'X-Requested-By: ambari' -X PUT -d '{"HostRoles": {"state": "STARTED"}}' http://{$ambari_master_host}:{$ambari_master_port}/api/v1/clusters/{$clustername}hosts/{$host}/host_...;

Same steps are followed by the ambari server when doing the recommission. PFA the logs

// Recomission ( Decommission with include host )

14 Feb 2018 13:28:23,479 INFO [ambari-client-thread-75749] AmbariManagementControllerImpl:3984 - Received action execution request, clusterName=xxxx , request=isCommand :true, action :null, command :DECOMMISSION, inputs :{included_hosts=xxxx, slave_type=NODEMANAGER}, resourceFilters: [RequestResourceFilter{serviceName='YARN', componentName='RESOURCEMANAGER', hostNames=[]}], exclusive: false, clusterName :xxxx

14 Feb 2018 13:28:23,488 INFO [ambari-client-thread-75749] AmbariCustomCommandExecutionHelper:967 - Recommissioning NODEMANAGER and marking Maintenance=OFF on xxx

14 Feb 2018 13:28:32,906 INFO [qtp-ambari-agent-75726] HeartBeatHandler:332 - HeartBeatHandler.sendCommands: sending ExecutionCommand for host xxx role RESOURCEMANAGER, roleCommand CUSTOM_COMMAND, and command ID 25366-0, task ID 45097

// Ambari changes state from Started to Installed

14 Feb 2018 13:28:44,295 INFO [ambari-heartbeat-processor-0] HeartbeatProcessor:609 - State of service component NODEMANAGER of service YARN of cluster xxx has changed from STARTED to INSTALLED at host xxxx according to STATUS_COMMAND report

14 Feb 2018 13:30:29,889 INFO [ambari-client-thread-75692] AbstractResourceProvider:939 - Received a updateHostComponent request, clusterName=xxx , serviceName=YARN, componentName=NODEMANAGER, hostname=xxxxx request={ clusterName=xxxx , serviceName=YARN, componentName=NODEMANAGER, hostname= xxxx , publicHostname=null, desiredState=STARTED, state=null, desiredStackId=null, staleConfig=null, adminState=null, maintenanceState=null}

// Ambari changes state again from Started to Installed

14 Feb 2018 13:30:29,890 INFO [ambari-client-thread-75692] AbstractResourceProvider:650 - Handling update to host component, clusterName=xxx, serviceName=YARN, componentName=NODEMANAGER, hostname=xxxxx , currentState=INSTALLED, newDesiredState=STARTED

14 Feb 2018 13:30:29,910 INFO [ambari-action-scheduler] ServiceComponentHostImpl:1028 - Host role transitioned to a new state, serviceComponentName=NODEMANAGER, hostName=xxxx oldState=INSTALLED, currentState=STARTING

Don't have an account?
Coming from Hortonworks? Activate your account here