Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 curl -u admin:admin -X DELETE  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICENAME

Removing a Host (1.4.1)

Verified against releases 1.4.1

The preferred way to remove a host is to move the master services from the host, decommission the slave nodes and then remove the host after deleting all the host components. However, there are situations such as the host is lost and cannot be brought back online for graceful removal. Under this circumstances the following API calls can be used to clean up the host. 

1. Get a list of host components mapped to the host

Code Block

 curl -u admin:admin -X GET  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME

See the property, "host_components"  for all the host.

Sample:

Code Block

 Output:
"host_components" : [
    {
      "href" : "http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTERNAME/hosts/HOSTNAME/host_components/DATANODE",
      "HostRoles" : {
        "cluster_name" : "CLUSTERNAME",
        "component_name" : "DATANODE",
        "host_name" : "HOSTNAME"
      }
    },
    {
      "href" : "http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTERNAME/hosts/HOSTNAME/host_components/GANGLIA_MONITOR",
      "HostRoles" : {
        "cluster_name" : "CLUSTERNAME",
        "component_name" : "GANGLIA_MONITOR",
        "host_name" : "HOSTNAME"
      }
    }]

2. DELETE all host components mapped to this host

Code Block

 E.g. Delete DATANODE
curl -u admin:admin -X DELETE http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTERNAME/hosts/HOSTNAME/host_components/DATANODE

3. DELETE the host

Code Block

curl -u admin:admin -X DELETE http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTERNAME/hosts/HOSTNAME