<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Delete a service using Ambari API in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114100#M76898</link>
    <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt;.  &lt;/P&gt;&lt;P&gt;Thanks and I am able to delete the service. &lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 13:29:55 GMT</pubDate>
    <dc:creator>anand_ranganath</dc:creator>
    <dc:date>2017-02-20T13:29:55Z</dc:date>
    <item>
      <title>Delete a service using Ambari API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114096#M76894</link>
      <description>&lt;P&gt;I am trying to delete a service but I am unable to do it. In the past I was successful in deleting the service but this time it is throwing weird error. &lt;/P&gt;&lt;PRE&gt;curl -u admin:xxxxxxxx -H  "X-Requested-By: ambari" -X DELETE   &lt;A href="http://localhost:8080/api/v1/clusters/prod/services/PRESTO" target="_blank"&gt;http://localhost:8080/api/v1/clusters/prod/services/PRESTO&lt;/A&gt;
{
  "status": 500,
  "message": "Server Error"
} &lt;/PRE&gt;&lt;P&gt;How do I delete the service  ? &lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 08:07:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114096#M76894</guid>
      <dc:creator>anand_ranganath</dc:creator>
      <dc:date>2017-02-20T08:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a service using Ambari API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114097#M76895</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3560/anandranganathan.html" nodeid="3560"&gt;@Anandha L Ranganathan&lt;/A&gt;&lt;/P&gt;&lt;P&gt;
Before deleting the PRESTO service have you properly stopped it? Like following:&lt;/P&gt;&lt;PRE&gt;curl -u admin:xxxxxxxx -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop PRESTO via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' &lt;A href="http://localhost:8080/api/v1/clusters/prod/services/PRESTO" target="_blank"&gt;http://localhost:8080/api/v1/clusters/prod/services/PRESTO&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If it is still failing with the "500 Error" then please share the&lt;EM&gt;&lt;STRONG&gt; ambari-server.log&lt;/STRONG&gt;&lt;/EM&gt; that will provide us the complete stackTrace of the error.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 10:51:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114097#M76895</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-02-20T10:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a service using Ambari API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114098#M76896</link>
      <description>&lt;P&gt;Thanks for the quick reply.  Here are the logs from ambari-server. &lt;/P&gt;&lt;PRE&gt;20 Feb 2017 03:28:57,527  INFO [qtp-ambari-client-3389] ClusterImpl:2052 - Deleting service for cluster, clusterName=prod, serviceName=PRESTO
20 Feb 2017 03:28:57,528  INFO [qtp-ambari-client-3389] ServiceImpl:608 - Deleting all components for service, clusterName=prod, serviceName=PRESTO
20 Feb 2017 03:28:57,528  INFO [qtp-ambari-client-3389] ServiceImpl:574 - Deselecting config mapping for cluster, clusterId=2, configTypes=[]
20 Feb 2017 03:28:57,531 ERROR [qtp-ambari-client-3389] AmbariJpaLocalTxnInterceptor:180 - [DETAILED ERROR] Rollback reason:
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))) AND (selected &amp;gt; 0))' at line 1
Error Code: 1064
Call: SELECT type_name, create_timestamp, cluster_id, selected, version_tag, user_name FROM clusterconfigmapping WHERE (((cluster_id = ?) AND (type_name IN ())) AND (selected &amp;gt; ?))
	bind =&amp;gt; [2 parameters bound]
Query: ReadAllQuery(referenceClass=ClusterConfigMappingEntity sql="SELECT type_name, create_timestamp, cluster_id, selected, version_tag, user_name FROM clusterconfigmapping WHERE (((cluster_id = ?) AND (type_name IN ?)) AND (selected &amp;gt; ?))")
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:682)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)
	at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)
	at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:694)
	at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2738)
	at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2691)
	at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:495)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
	at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1751)
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258)
	at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469)
	at org.apache.ambari.server.orm.dao.DaoUtils.selectList(DaoUtils.java:62)
	at org.apache.ambari.server.orm.dao.ClusterDAO.getSelectedConfigMappingByTypes(ClusterDAO.java:259)
	at org.apache.ambari.server.orm.AmbariLocalSessionInterceptor.invoke(AmbariLocalSessionInterceptor.java:53)
	at org.apache.ambari.server.state.ServiceImpl.deleteAllServiceConfigs(ServiceImpl.java:577)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:118)
	at org.apache.ambari.server.state.ServiceImpl.delete(ServiceImpl.java:680)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:128)
	at org.apache.ambari.server.state.cluster.ClusterImpl.deleteService(ClusterImpl.java:2081)
	at org.apache.ambari.server.state.cluster.ClusterImpl.deleteService(ClusterImpl.java:2060)
	at org.apache.ambari.server.controller.internal.ServiceResourceProvider.deleteServices(ServiceResourceProvider.java:886)
	at org.apache.ambari.server.controller.internal.ServiceResourceProvider$3.invoke(ServiceResourceProvider.java:247)
	at org.apache.ambari.server.controller.internal.ServiceResourceProvider$3.invoke(ServiceResourceProvider.java:244)
	at org.apache.ambari.server.controller.internal.AbstractResourceProvider.invokeWithRetry(AbstractResourceProvider.java:450)
	at org.apache.ambari.server.controller.internal.AbstractResourceProvider.modifyResources(AbstractResourceProvider.java:331)
	at org.apache.ambari.server.controller.internal.ServiceResourceProvider.deleteResources(ServiceResourceProvider.java:244)
	at org.apache.ambari.server.controller.internal.ClusterControllerImpl.deleteResources(ClusterControllerImpl.java:330)
	at org.apache.ambari.server.api.services.persistence.PersistenceManagerImpl.delete(PersistenceManagerImpl.java:111)

&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 11:30:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114098#M76896</guid>
      <dc:creator>anand_ranganath</dc:creator>
      <dc:date>2017-02-20T11:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a service using Ambari API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114099#M76897</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3560/anandranganathan.html" nodeid="3560"&gt;@Anandha L Ranganathan&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The "&lt;STRONG&gt;MySQLSyntaxErrorException&lt;/STRONG&gt;" looks strange here looks buggy. Which version of ambari are you using? &lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;- However as a quick workaround you might want to try the following approach to delete the "PRESTO" service completely.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Stop ambari-server&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;ambari-server stop&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;2. Take ambari Database backup for Safety.&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;mysqldump $dbname &amp;gt;/tmp/ambari_db_dump.sql

Exampel:
mysqldump ambari &amp;gt;/tmp/ambari_db_dump.sql&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;3. Now in the ambari Database run the following commands. This will clear the PRESTO service entry from you ambari DB.
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;    delete from hostcomponentstate where service_name = 'PRESTO';
    delete from hostcomponentdesiredstate where service_name = 'PRESTO';
    delete from servicecomponentdesiredstate where service_name = 'PRESTO';
    delete from servicedesiredstate where service_name = 'PRESTO';
    delete from serviceconfighosts where service_config_id in (select service_config_id from serviceconfig where service_name = 'PRESTO');
    delete from serviceconfigmapping where service_config_id in (select service_config_id from serviceconfig where service_name = 'PRESTO');
    delete from serviceconfig where service_name = 'PRESTO';
    delete from requestresourcefilter where service_name = 'PRESTO';
    delete from requestoperationlevel where service_name = 'PRESTO';
    delete from clusterservices where service_name ='PRESTO';
    delete from clusterconfig where type_name like 'presto%';
    delete from clusterconfigmapping where type_name like 'presto%';&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;4. Now restart ambari-server&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;ambari-server start&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 11:56:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114099#M76897</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-02-20T11:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a service using Ambari API</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114100#M76898</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt;.  &lt;/P&gt;&lt;P&gt;Thanks and I am able to delete the service. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 13:29:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Delete-a-service-using-Ambari-API/m-p/114100#M76898</guid>
      <dc:creator>anand_ranganath</dc:creator>
      <dc:date>2017-02-20T13:29:55Z</dc:date>
    </item>
  </channel>
</rss>

