Thanks Alejandro, I executed the commands to delete the service. Do you not think REST API should also execute update the tables to avoid any confusions?
Regards, DP On 8 December 2015 at 18:25, Alejandro Fernandez <[email protected] > wrote: > Hi Darpan, > > I suspect that the curl call to delete KNOX only removed it from some of > the database tables. > Removing a services does not make any modifications to the actual agents, > such as removing bits and configs. > If you re-add that service you may have to make sure that no other tables > have references to it. E.g. > > DELETE FROM hostcomponentstate WHERE service_name IN ('KNOX'); > DELETE FROM hostcomponentdesiredstate WHERE service_name IN ('KNOX'); > DELETE FROM servicecomponentdesiredstate WHERE service_name IN ('KNOX'); > DELETE FROM servicedesiredstate WHERE service_name IN ('KNOX'); > DELETE FROM clusterservices WHERE service_name IN ('KNOXr'); > > Thanks, > Alejandro > > From: Darpan Patel <[email protected]> > Reply-To: "[email protected]" <[email protected]> > Date: Tuesday, December 8, 2015 at 7:32 AM > To: "[email protected]" <[email protected]>, " > [email protected]" <[email protected]> > Subject: Issue removing and re-adding the components in Ambari > > Hi folks, > > I am running Version 2.1.2 of Ambari , HDP 2.3 on multinode cluster. > I was facing the issues in Knox component so decided to remove the service > and re-install it. > So I removed issued following command and it disappeared through Ambari > web portal. > // valid admin > > *curl -v -u admin:Ambari-AdminPassword -H "X-Requested-By:ambari" -X > DELETE "http://AMBARI_HOST:8080/api/v1/clusters/SecureCluster/services/KNOX > <http://AMBARI_HOST:8080/api/v1/clusters/SecureCluster/services/KNOX>" * > > However when I check in the /usr/hdp/2.3.2.0-2950 directory I found that > knox-server and it's directories were not removed. I manually deleted this > directory and re-initiated the Knox setup through Ambari. It goes up to > step 6 and shows a popup saying : Internal Server error. > > > When I check the Ambari-server logs it looks like service is already > present. > > *Caused by: 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.* > *Error Code: 0* > Call: INSERT INTO clusterservices (service_name, service_enabled, > cluster_id) VALUES (?, ?, ?) > bind => [3 parameters bound] > Query: > InsertObjectQuery(org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity@fadf9954 > ) > at > org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1611) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:898) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:962) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:631) > at > org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatch(ParameterizedSQLBatchWritingMechanism.java:149) > at > org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:134) > at > org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.appendCall(ParameterizedSQLBatchWritingMechanism.java:82) > ....... > *Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value > violates unique constraint "clusterservices_pkey"* > * Detail: Key (service_name, cluster_id)=(KNOX, 2) already exists.* > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) > > What is the way around? Am I supposed to manually remove the Ambari > related database/tables, in which scenario which db/table should we update > manually? > > Regards, > DP >
