Update Host Component

Back to Resources

Summary

Update a host component for a given host and component.

PUT api/v1/clusters/:name/hosts/:hostName/host_components/:hostComponentName

Response

Example 1

Start the NAMENODE component by updating its state to ‘STARTED’.

PUT api/v1/clusters/c1/hosts/hostname/host_components/NAMENODE

{
  "HostRoles":{
    "state":"STARTED"
  }
}


202 Accepted
{
  "href" : "http://your.ambari.server:8080/api/v1/clusters/c1/requests/12",
  "Requests" : {
    "id" : 12,
    "status" : "InProgress"
  }
}

**Example 2 **

Stop the NAMENODE component by updating its state to ‘INSTALLED’.

PUT api/v1/clusters/c1/hosts/hostname/host_components/NAMENODE

{
  "HostRoles":{
    "state":"INSTALLED"
  }
}


202 Accepted
{
  "href" : "http://your.ambari.server:8080/api/v1/clusters/c1/requests/13",
  "Requests" : {
    "id" : 13,
    "status" : "InProgress"
  }
}

**Example 3 **

Put the NAMENODE component into ‘MAINTENANCE’ mode.

PUT api/v1/clusters/c1/hosts/hostname/host_components/NAMENODE

{
  "HostRoles":{
    "state":"MAINTENANCE"
  }
}


202 Accepted
{
  "href" : "http://your.ambari.server:8080/api/v1/clusters/c1/requests/14",
  "Requests" : {
    "id" : 14,
    "status" : "InProgress"
  }
}