Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Is there a way to remove the services from ambari and add the services once again?

avatar
Contributor
 
1 ACCEPTED SOLUTION

avatar
Contributor

13899-amba.png

This are the things i could find in service actions tab

View solution in original post

10 REPLIES 10

avatar
Master Mentor

@saravanan gopalsamy

Yes, Either you can remove the services from Ambari UI as following:

Ambari UI --> Ambari Metrics Collector (Or any service that you want to delete) --> Service Action (Drop down menu) --> "Delete Service" (Button)

.

Or use the Ambari Rest API to do the same : https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+compon...

-

Here is an example removing METRICS_COLLECTOR from a host.

# curl -u admin -H "X-Requested-By: ambari" -X DELETE http://<AMBARI_HOST>:8080/api/v1/clusters/<CLUSTERNAME>/hosts/hdmdup0002.machine.test.group/host_com...

- Which version of ambari are you using that also matters. Because you can delete services from ambari UI from Ambari 2.4.x version else you will have to use the Rest API as mentioned in the above link.

avatar
Contributor

Hi Jay thanks a lot for the help but i cant find any option to remove the services in Ambari UI..

avatar
Master Mentor

@saravanan gopalsamy

As mentioned earlier that you can delete services from ambari UI from Ambari 2.4.x version else you will have to use the Rest API as mentioned in the above link.

In Ambari 2.2.1 that feature is not available in ambari UI. So you will need to either use the Ambari API or more simplest way is to delete the service directly from the Database as mentioned in the following article.

.

(Easiest and quick option) Deleting Service entry directly from Database using the following query:

    delete from hostcomponentstate where service_name = 'KNOX';
    delete from hostcomponentdesiredstate where service_name = 'KNOX';
    delete from servicecomponentdesiredstate where service_name = 'KNOX';
    delete from servicedesiredstate where service_name = 'KNOX';
    delete from serviceconfighosts where service_config_id in (select service_config_id from serviceconfig where service_name = 'KNOX');
    delete from serviceconfigmapping where service_config_id in (select service_config_id from serviceconfig where service_name = 'KNOX');
    delete from serviceconfig where service_name = 'KNOX';
    delete from requestresourcefilter where service_name = 'KNOX';
    delete from requestoperationlevel where service_name = 'KNOX';
    delete from clusterservices where service_name ='KNOX';
    delete from clusterconfig where type_name like 'knox%';
    delete from clusterconfigmapping where type_name like 'knox%';

.

Please see: https://community.hortonworks.com/content/kbentry/81939/how-to-resolve-ambari-db-inconsistency-error...

Then you will need to restart Ambari Server.

avatar
Contributor

@Jay SenSharma Thanks for your help..Let me try this one.Moreover i tried the curl calls as well but still i could not delete the services

avatar
Master Mentor

@saravanan gopalsamy

Sure, The Database queries should definitely work well as it leaves no foot print in the database of the service that we wanted to delete and completely cleans all the entries related to that mentioned service from the Database completely. You will need to restart AmbariServer after making the database changes.

avatar
Contributor

13899-amba.png

This are the things i could find in service actions tab

avatar

@saravanan gopalsamy Which version of ambari are you using?

avatar
Contributor

@Ayub Khan 2.2.1.0 is amabri version and hdp version is 2.4.3.0-227