Ambari 2.4 UI presents the option to delete HAWQ services on segments. While deleting a HAWQ segment from a host, sometimes the DELETE option is grayed out and disabled as shown in the image below.
This article explains the cause of the delete option getting disabled. Also, it touches upon the concept of auto recovery in Ambari.
The auto recovery process has a completely different implementation for versions before Ambari 2.4. This article is specific to version 2.4 and later. To delve into Ambari's auto recovery feature, please refer to Recovery: Auto Start Components.
Ambari auto start is a feature that enables certain components to be marked for the auto start so that whenever a node restarts, the Ambari agent automatically restarts the stopped components. Auto start of a component is based on its current state and desired state.
In this scenario, the affected host is restarted and auto recovery kicks in. Auto recovery starts the stopped components and marks its desired state as STARTED for this HAWQ segment. This can be seen in Ambari agent log from the affected server. The message is logged as shown below:
INFO 2016-11-14 14:22:51,944 RecoveryManager.py:204 - New status, desired status is set to STARTED for HAWQSEGMENT
Remove the segment on the affected host using Ambari API calls.
Note: This process assumes that the necessary backup has been executed before removing the segment. Do confirm this before proceeding further.
Follow the steps below to resolve the issue:
1. Stop the HAWQ segment:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Component"},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://<AMBARI_SERVER>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<AFFECTED_HOST>/host_components/HAWQSEGMENT
2. Delete the HAWQ segment from the affected host:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://<AMBARI_SERVER>:8080/api/v1/clusters/<CLUSTER_NAME>/hosts/<AFFECTED_HOST>/host_components/HAWQSEGMENT
3. The segment should now be deleted.