You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Verified against releases 1.2.3

At times you may need to delete a service or all host components on a host. This article talks about how to do that using APIs. Be aware of losing data when performing any delete operations. Ensure that your data is backed up and decommissioning of nodes are performed as needed.

Removing a Service (1.2.3)

These API calls do not uninstall the packages associated with the service and neither do the remove the config or temp folders associated with the service components. 

Before the PUT or DELETE calls you can do a GET to ensure that the API is referring to a valid resource.

1. Ensure the service is stopped (you can use the Ambari Web-UI to stop the service as well)

Stop the whole service (ensure correct values are provided for AMBARI_SERVER_HOST, SERVICE_NAME):

 curl -u admin:admin -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICE_NAME

Stop individual components (ensure correct values are provided for AMBARI_SERVER_HOST, HOSTNAME, COMPONENT_NAME): 

 curl -u admin:admin -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENT_NAME
 curl -u admin:admin -X PUT -d '{"HostRoles": {"state": "MAINTENANCE"}}' http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENTNAME
 curl -u admin:admin -X DELETE  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENTNAME
 curl -u admin:admin -X DELETE  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/services/SERVICENAME
  • No labels