Created 12-05-2017 06:03 PM
how to remove the following component by API from worker machine
we need to remove these component since ambari GUI not have the option to delete this component /component clients from worker machine
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com | grep component_name % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 24661 100 24661 0 0 164k 0 --:--:-- --:--:-- --:--:-- 164k "component_name" : "DATANODE", "component_name" : "HCAT", "component_name" : "HDFS_CLIENT", "component_name" : "HIVE_CLIENT", "component_name" : "METRICS_MONITOR", "component_name" : "NODEMANAGER", "component_name" : "PIG", "component_name" : "SLIDER", "component_name" : "SPARK2_CLIENT", "component_name" : "TEZ_CLIENT", "component_name" : "YARN_CLIENT", "component_name" : "ZOOKEEPER_CLIENT",
Created 12-05-2017 06:17 PM
You can stop the Components and then delete them as following: (for example DataNode)
Stop DataNode (or desired component)
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Datanode","operation_level":{"level":"HOST_COMPONENT","cluster_name":"HDP","host_name":"worker04.sys45.com","service_name":"HDFS"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/DATANODE
.
Delete DataNode:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/DATANODE
.
Similarly you can do the same for other components as well like NodeManager .../etc
Created 12-05-2017 06:17 PM
You can stop the Components and then delete them as following: (for example DataNode)
Stop DataNode (or desired component)
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Datanode","operation_level":{"level":"HOST_COMPONENT","cluster_name":"HDP","host_name":"worker04.sys45.com","service_name":"HDFS"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/DATANODE
.
Delete DataNode:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/DATANODE
.
Similarly you can do the same for other components as well like NodeManager .../etc
Created on 12-05-2017 06:32 PM - edited 08-17-2019 08:01 PM
after we delete the components by API I still see the component in the worker machine ( even after ambari-server restart and ambari agent restart , what need to do ?
Created 12-05-2017 06:41 PM
For AMS monitor process please run the DELETE command twice:
.
Example:
# curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/METRICS_MONITOR # curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/METRICS_MONITOR
.
The check the Ambari UI. Please try the same for other client components as well.
Created on 12-05-2017 06:48 PM - edited 08-17-2019 08:00 PM
after we delete the component from the API we see the components still from the ambari GUI ( and after ambari-server restart )
how it can be?
Created 12-05-2017 06:53 PM
If you still see the components in your AMbari UI then please check the "ambari-server.log" you must see some errors during the Deletion of those components in the log. The error will tell us the cause.
So please try the following:
1. Put the ambari-server.log in "tail" to see any latest error:
# tail -f /var/log/ambari-server/ambari-server.log
2. Now try deleting the problematic components and observe the "ambari-server.log" if there are any errors?
# curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02:8080/api/v1/clusters/HDP/hosts/worker04.sys45.com/host_components/METRICS_MONITOR
.
Try opening the Browser in "Incognito" (Private) mode to isolate any browser caching issue.
.
Created 12-05-2017 07:12 PM
this is the complete syntax but I get error that cant understand ,
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02.dddns.com:8080/api/v1/clusters/HDP/hosts/worker04.dddns.com/host_components/METRICS_... { "status" : 404, "message" : "org.apache.ambari.server.controller.spi.NoSuchResourceException: The specified resource doesn't exist: ServiceComponentHost not found, clusterName=HDP, serviceName=AMBARI_METRICS, serviceComponentName=METRICS_MONITOR, hostName=worker04.dddns.com"
Created 12-05-2017 07:32 PM
In your first update the Hostname was not complete for ambari host. (Is that a typo "master02.dddns.com" or it should be "master02" )
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://master02.dddns.com:8080/api/v1/clusters/HDP/hosts/worker04.dddns.com/host_components/METRICS_...
.
Also the hostname of worker is different "worker04.dddns.com" (or it should be "worker04.sys45.com")
Are you sure that your host "worker04.dddns.com" really has AMS monitor installed to it? Please confirm the same using GET command to see if MONITOR is listed int eh output of the following API call?
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://master02.dddns.com:8080/api/v1/clusters/HDP/hosts/worker04.dddns.com/host_components