Pivotal Knowledge Base

Follow

Unable to remove Ganglia; error message "Service must be stopped or disabled" seen

Environment

Product Version
Pivotal HD (Hadoop) 3.x
Ambari 2.1.2
OS RHEL 6.x

Symptom

After upgrading to Ambari 2.1.2 from Ambari 1.7.1, it is recommended to remove Ganglia as it is replaced by Ambari Metrics. However, while removing Ganglia, the following error message is seen:

[root@AMBARNODE ~]# curl -u admin:admin -k -H 'X-Requested-By:ambari' -X DELETE 'https://AMBARISERVER:8080/api/v1/clusters/CLUSTERNAME/services/GANGLIA' 
{
"status" : 500,
"message" : "org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: Cannot remove GANGLIA. Desired state STARTED is not removable. Service must be stopped or disabled."

Cause

Even though the Ganglia service is stopped in Ambari, some components may not be correctly marked as stopped in the Ambari metadata.

Resolution

The following commands should be run as root on the Ambari Node (replace the text within <> with the relevant hostnames):

#STOP THE GANGLIA SERVICE
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/services/GANGLIA

#STOP THE SERVER AND MONITOR ON THE GANGLIA SERVER
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<GANGLIA_SERVER_FQDN>/host_components/GANGLIA_SERVER
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<GANGLIA_SERVER_FQDN>/host_components/GANGLIA_MONITOR

#STOP THE GANGLIA MONITOR ON ***EVERY*** NODE (REPEAT FOR EACH NODE WHERE GANGLIA IS MONITORING):
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<HOST_FQDN>/host_components/GANGLIA_MONITOR

#STOP EACH SERVICE COMPONENT:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop All Components"},"Body":{"ServiceComponentInfo":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/services/GANGLIA/components/GANGLIA_SERVER
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop All Components"},"Body":{"ServiceComponentInfo":{"state":"INSTALLED"}}}' https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/services/GANGLIA/components/GANGLIA_MONITOR

#RERUN TO CHECK ALL COMPONENTS ARE STOPPED:
curl --user admin:admin https://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/services/GANGLIA

#REMOVE THE GANGLIA SERVICE: 
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://<AMBARI_NODE>:8080/api/v1/clusters/<CLUSTER_NAME>/services/GANGLIA

Once completed, log into Ambari, and check that Ganglia no longer shows up. 

 

Comments

Powered by Zendesk