Support Questions

Find answers, ask questions, and share your expertise

Uninstall Knox and installing again

avatar
Rising Star

Hi Guys,

We setup a new HDP cluster with Ambari version 2.1, with HDP version 2.3.4 and Knox version 0.6, after successful installation of knox for the first time, we tried to configure it with LDAP and tried to restart the knox gateway service, which didn't work and it seemed to be a bug which will be resolved in the next version of Ambari, then we thought to Delete Knox service via REST API and install it once again with Ambari, which is not working now as at the end of setup from Ambari we only get and error message "server error" from Ambari. Any ideas or suggestions that what should be the next step? Thanks in advance.

Regards,

Hammad Ali

1 ACCEPTED SOLUTION

avatar

You can remove it from the PostgresDB by runnign below from Ambari node:

su postgres
psql
\c ambari

DELETE FROM ambari.hostcomponentstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.hostcomponentdesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.servicecomponentdesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.servicedesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.clusterservices WHERE service_name IN ('KNOX');

View solution in original post

11 REPLIES 11

avatar
Master Mentor
@Hammad Ali

You can delete knox through rest api

Run this in Ambari host

curl --user admin:admin -i -H "X-Requested-By: ambari" -X DELETE http://`hostname -f`:8080/api/v1/clusters/clustername/services/KNOX

Restart ambari server and see whats in the logs.

Clear broweser cache and try to login

avatar
Master Mentor

avatar
Master Mentor

@Hammad Ali Ambari 2.2 is out, why not go with that?

avatar
Rising Star

@Neeraj Sabharwal Thanks for your answer, I deleted the Knox service with the above mentioned command, which i tried many time before too, when i checked on ambari the service is gone, then I restarted the ambari server and I found the this exception in the logs:

Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "clusterservices_pkey" Detail: Key (service_name, cluster_id)=(KNOX, 2) already exists.

Moreover I can see the knox service with yellow sign once again in the ambari, my assumption is that the service is not being deleted from ambari database properly due to which I am also unable to install it once again.

Any feedback or advice, what is happening actually and how to proceed (we might need to delete it from database)?

Thanks in advance.

Hammad Ali

avatar

You can remove it from the PostgresDB by runnign below from Ambari node:

su postgres
psql
\c ambari

DELETE FROM ambari.hostcomponentstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.hostcomponentdesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.servicecomponentdesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.servicedesiredstate WHERE service_name IN ('KNOX');
DELETE FROM ambari.clusterservices WHERE service_name IN ('KNOX');

avatar
Master Mentor

Adding step for 1 for future users

Step 1) curl --user admin:admin -i -H "X-Requested-By: ambari" -X DELETE http://`hostname -f`:8080/api/v1/clusters/clustername/services/KNOX

Step 2) Ali's workaround

avatar
Super Collaborator

This works 100%

Thanks @Ali Bajwa and @Neeraj Sabharwal

avatar

HDP 2.3.4 Needs Ambari 2.2. You cannot use Ambari 2.1

avatar
Master Mentor