I hope this will get easier with Ambari next time. The easiest way to remove a host server1.domain.net from an Ambari Cluster (ambari.domain.net) right now is:
1 – Run this curl command to get installed services on this host (admin:admin is the username:password you were using to access your Ambari GUI, cluster_name is the name of your cluster).
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.fr/host_components | grep host_components
The result will look like :
"href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HBASE_CLIENT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HCAT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HDFS_CLIENT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HIVE_CLIENT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HIVE_METASTORE", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HIVE_SERVER", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HST_AGENT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/INFRA_SOLR_CLIENT", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/KNOX_GATEWAY", "href" : "http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/MAPREDUCE2_CLIENT", ... "href" : "http://ambari.domain.net:8080/api/v1/clusters/bopam_clu/hosts/server1.domain.net/host_components/METRICS_MONITOR", "href" : "http://ambari.domain.net:8080/api/v1/clusters/bopam_clu/hosts/server1.domain.net/host_components/MYSQL_SERVER",
2 – Delete the listed services by issuing the following curl command for each SERVICE NAME :
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/SERVICE_NAME
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net/host_components/HBASE_CLIENT
3 – You can now delete the host:
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE http://ambari.domain.net:8080/api/v1/clusters/cluster_name/hosts/server1.domain.net
4 – Check the rest of the services depending on this host.
We are always still waiting for the Ambari multi-cluster support and the famous multi-everything architecture from HortonWorks team.
If you want to remove an Ambari-through install of HDP components, you will have to it manually.
Actually, Ambari gives you a way to uninstall services and remove hosts. But, this feature assumes that you have completed the components install process successfully. What if the process fails somewhere when installing?
In my case, I collected all the commands from many posts and grouped them into one single script. You can find the script in my github.
By the way, this is a very well written manual on how to setup HDP 2.5.