Versions Compared

Key

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

...

Removing a Service (1.2.3)

Note: These API calls do not uninstall the packages associated with the service and neither do the they 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. Note all the host components associated with the service.

Code Block

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

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

...

Code Block
 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

3. Put MASTER and SLAVE components into MAINTENANCE mode

Code Block
 curl -u admin:admin -X PUT -d '{"HostRoles": {"state": "MAINTENANCE"}}' http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENTNAME

4. Delete MASTER and SLAVE components

Code Block
 curl -u admin:admin -X DELETE  http://AMBARI_SERVER_HOST:8080/api/v1/clusters/c1/hosts/HOSTNAME/host_components/COMPONENTNAME

4. Delete the whole SERVICE

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