Support Questions

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

How to clear / remove the failed host components / services after failed installation

avatar
Rising Star

HI

I tried installing the services HIVE, TEZ, PIG to the existing cluster and it got failed. I wanted to remove / clean up the components and services. In the Since the installation is failed, i could not find the component to decommission and then remove. Only HCAT got installed. Tried through API to remove the service, it is getting failed with the below error.

CSRF option is not in ambari.properties file as well.

$ cat /etc/ambari-server/conf/ambari.properties | grep -i CSR [root@ip-172-27-3-42.ap-southeast-1.compute.internal]:/home/ambari $

$ curl -u admin:xxxx -H “X-Requested-By: ambari” -X GET http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE
curl: (6) Could not resolve host: xn--ambari-1i0c; Name or service not known
{
  "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE",
  "ServiceInfo" : {
    "cluster_name" : "eim_edl_dev_cluster_1",
    "maintenance_state" : "OFF",
    "service_name" : "HIVE",
    "state" : "INSTALL_FAILED"
  },
  "alerts_summary" : {
    "CRITICAL" : 0,
    "MAINTENANCE" : 0,
    "OK" : 0,
    "UNKNOWN" : 0,
    "WARNING" : 0
  },
  "alerts" : [ ],
  "components" : [
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/HCAT",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "HCAT",
        "service_name" : "HIVE"
      }
    },
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/HIVE_CLIENT",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "HIVE_CLIENT",
        "service_name" : "HIVE"
      }
    },
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/HIVE_METASTORE",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "HIVE_METASTORE",
        "service_name" : "HIVE"
      }
    },
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/HIVE_SERVER",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "HIVE_SERVER",
        "service_name" : "HIVE"
      }
    },
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/MYSQL_SERVER",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "MYSQL_SERVER",
        "service_name" : "HIVE"
      }
    },
    {
      "href" : "http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE/components/WEBHCAT_SERVER",
      "ServiceComponentInfo" : {
        "cluster_name" : "eim_edl_dev_cluster_1",
        "component_name" : "WEBHCAT_SERVER",
        "service_name" : "HIVE"
      }
    }
  ],
  "artifacts" : [ ]

======================================

$ curl -u admin:xxxxx -H “X-Requested-By: ambari” -X DELETE http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE
curl: (6) Could not resolve host: xn--ambari-1i0c; Name or service not known
{
  "status" : 400,
  "message" : "CSRF protection is turned on. X-Requested-By HTTP header is required."

$ curl -u admin:xxxxx -H “X-Requested-By: ambari” -X DELETE -d ‘{“RequestInfo”:{“state”:”INSTALL_FAILED”}}’ http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE
curl: (6) Could not resolve host: xn--ambari-1i0c; Name or service not known
{
  "status" : 400,
  "message" : "CSRF protection is turned on. X-Requested-By HTTP header is required.
1 ACCEPTED SOLUTION

avatar
Expert Contributor

@Muthukumar S : The issue is with the double quotes you used around X-Requested-By: ambari. When I tried copy pasting the url you have pasted, I got the same issue as you.

I tried with single quotes like :

curl -u admin:admin -H 'X-Requested-By: ambari' -X DELETE -d ‘{“RequestInfo”:{“state”:”INSTALL_FAILED”}}’ http://172.22.127.69:8080/api/v1/clusters/cl1/services/HIVE

and it worked.

Have you used an editor which does a formatting because it looks like the quotes you used were special quotes which lead to the header not being read by curl.

Here is a link on how to delete a service. You will not be able to delete the service if it has components installed. The link has commands to delete components as well :

https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+compon...

PS : Make sure when you copy/paste, you replace the double quotes in the terminal or a reliable editor.

View solution in original post

4 REPLIES 4

avatar
Contributor

Hi can you try this command:

curl -u admin:admin -i -H 'X-Requested-By: ambari' -X DELETE http://AMBAIRHOST:8080/api/v1/clusters/CLUSTERNAME/services/HIVE

avatar
Rising Star

@sganatra

curl -u admin:xxxx -i -H “X-Requested-By: ambari” -X DELETE http://172.27.3.42:8080/api/v1/clusters/eim_edl_dev_cluster_1/services/HIVE curl: (6) Could not resolve host: xn--ambari-1i0c; Name or service not known HTTP/1.1 400 Bad Request X-Frame-Options: DENY X-XSS-Protection: 1; mode=block User: admin Set-Cookie: AMBARISESSIONID=huz7jn29p3fggsw2xggfqto;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/plain Content-Length: 107 Server: Jetty(8.1.17.v20150415) { "status" : 400, "message" : "CSRF protection is turned on. X-Requested-By HTTP header is required."

avatar
Expert Contributor

@Muthukumar S : The issue is with the double quotes you used around X-Requested-By: ambari. When I tried copy pasting the url you have pasted, I got the same issue as you.

I tried with single quotes like :

curl -u admin:admin -H 'X-Requested-By: ambari' -X DELETE -d ‘{“RequestInfo”:{“state”:”INSTALL_FAILED”}}’ http://172.22.127.69:8080/api/v1/clusters/cl1/services/HIVE

and it worked.

Have you used an editor which does a formatting because it looks like the quotes you used were special quotes which lead to the header not being read by curl.

Here is a link on how to delete a service. You will not be able to delete the service if it has components installed. The link has commands to delete components as well :

https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+compon...

PS : Make sure when you copy/paste, you replace the double quotes in the terminal or a reliable editor.

avatar
Rising Star

@sbhat

It worked, awesome. Thanks a lot.