Support Questions

Find answers, ask questions, and share your expertise

Delete Service : The ZooKeeper service can't be deleted, at least one service must be installed

avatar

I have manually removed all services from my Hadoop dev cluster and only service is not getting delete is ZooKeeper Server.

as it says "The ZooKeeper service can't be deleted, at least one service must be installed."

How to remove Zookeeper so that i can start a fresh installation for Hadoop Cluster?

Note: I am unable to add services keeping old ZooKeeper because of below error:- 500 status code received on POST method for API: /api/v1/stacks/HDP/versions/2.5/recommendations.

14523-clenaup.png

Thanks in Advance!!!

1 REPLY 1

avatar
Master Mentor

@Mukesh Kumar

- Login to your Ambari DB. For example postgres then:

# psql -U ambari ambari
Password for user ambari: bigdata

- Then run the following queries to completely remove the Zookeeper service from DB.

delete from hostcomponentstate where service_name = 'ZOOKEEPER'; 
delete from hostcomponentdesiredstate where service_name = 'ZOOKEEPER'; 
delete from servicecomponentdesiredstate where service_name = 'ZOOKEEPER'; 
delete from servicedesiredstate where service_name = 'ZOOKEEPER'; 
delete from alert_current where history_id in (select alert_id from alert_history where service_name = 'ZOOKEEPER'); 
delete from alert_notice where history_id in (select alert_id from alert_history where service_name = 'ZOOKEEPER'); 
delete from alert_history where service_name = 'ZOOKEEPER'; 
delete from alert_grouping where definition_id in (select definition_id from alert_definition where service_name = 'ZOOKEEPER'); 
delete from alert_history where alert_definition_id in (select definition_id from alert_definition where service_name = 'ZOOKEEPER'); 
delete from alert_current where definition_id in (select definition_id from alert_definition where service_name = 'ZOOKEEPER'); 
delete from alert_definition where service_name = 'ZOOKEEPER'; 
delete from alert_group_target where group_id in ( select group_id from alert_group where service_name = 'ZOOKEEPER'); 
delete from alert_group where service_name = 'ZOOKEEPER'; 
delete from serviceconfighosts where service_config_id in (select service_config_id from serviceconfig where service_name = 'ZOOKEEPER'); 
delete from serviceconfigmapping where service_config_id in (select service_config_id from serviceconfig where service_name = 'ZOOKEEPER'); 
delete from serviceconfig where service_name = 'ZOOKEEPER'; 
delete from requestresourcefilter where service_name = 'ZOOKEEPER'; 
delete from requestoperationlevel where service_name = 'ZOOKEEPER'; 
delete from clusterservices where service_name ='ZOOKEEPER'; 
delete from clusterconfig where type_name like 'zookeeper%'; 
delete from clusterconfigmapping where type_name like 'zookeeper%'; 

- Now restart ambari server:

# ambari-server restart

.

Additionally the 500 error for the API call "POST method for API: /api/v1/stacks/HDP/versions/2.5/recommendations." indicates a DB inconsistency. So if it is a fresh cluster then or if you do not want to have any service installed to is and move to the very initial state of ambari installation then better to perform an ambari reset instead of deleting services from ambari UI (As we see you only have zookeeper installed there)

# ambari-server reset

.

*NOTE:* It is always recommended to keep a DB dump as a backup before making any manual DB changes.