Red Alert: There is no ‘easy way’ to uninstall and completely remove the HDP components installed through ambari. I have seen,met and heard of a lot of people who just end up doing a fresh OS install, just because Ambari adds insane number of files to your system, in a variety of places with a lot of ‘symlinks’ that it just turns out to be ridiculously difficult to remove and uninstall HDP components completely. I believe I was a peculiar victim that got stuck in the vicious cycle of installing and uninstalling HDP components through ambari that I was spending more time in uninstalling these components and installing them again than I was in learning about this amazing open source platform, Hadoop. So, now that I have mastered the art of removing and uninstalling HDP components completely(if not anything else) including all hosts,services and its components, I record it for anyone’s and everyone’s reference. How to remove and uninstall HDP components completely? Here is a step by step tutorial to do just that: The HDP Uninstall! • 1. Stop all services in ambari You can stop all your services in ambari through Web-UI as well as command line: 1. To stop your services from Ambari web based user interface: Go to Ambari Web UI that runs on port 8080 by default. The URL to access Ambari UI would be structured like this: HOST_FQDN:8080/ Stop all services in ambari through Web UI Stop all services in ambari through Web UI Click on button Actions at the bottom right end and press stop all services. 2. To stop ambari services from command line interface using Ambari REST API You need to stop each of the services one after the other : curl -u ambari_USERNAME:ambari_PASSWORD -H “X-Requested-By: ambari” -X PUT -d ‘{“RequestInfo”:{“context”:”Stop Service”},”Body”:{“ServiceInfo”:{“state”:”INSTALLED”}}}’ http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/services/SERVICE_NAME If you would like to know names of each of those services, This guy here has done pretty amazing work in the post and shared names of each of the services in ambari and explains the deletion of ambari services as well as its host components. 2. Run this python script to clean up and remove a couple of folders created on your system that comprise the basic part of distribution: python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=users Note: Use –skip=users argument if you would like the users created for each of the servers/services not to be deleted. From what I have seen, it usually makes no difference and the users really need not be deleted. 3. Remove and clean hadoop packages completely Remove all of the Hortonworks HDP components and package by using yum remove command: For example: 1. Remove and uninstall hive completely, yum remove hive\* 2. Remove and uninstall oozie completely, yum remove oozie\* 3. Remove and uninstall pig completely, yum remove pig\* 4. Remove and uninstall zookeeper completely, yum remove zookeeper\* 5. Remove and uninstall tez completely, yum remove tez\* 6. Remove and uninstall hbase completely, yum remove hbase\* 7. Remove and uninstall ranger completely, yum remove ranger\* 8. Remove and uninstall knox completely, yum remove knox\* 9. Remove and uninstall ranger completely, yum remove ranger\* 10. Remove and uninstall storm completely, yum remove storm\* 11. Remove and uninstall accumulo completely, yum remove hadoop\* 12. Remove and uninstall zookeeper completely, yum remove hadoop\* 13. Remove and uninstall ambari-server ambari-server stopyum erase ambari-server 14. Remove and uninstall ambari-agent ambari-agent stopyum erase ambari-agent In case you are using some other distribution of linux, follow this link to find commands to remove these packages on your system. 4. Remove yum repositories meant for ambari and HDP components rm -rf /etc/yum.repos.d/ambari.repo /etc/yum.repos.d/HDP* yum clean all 5. Clean all folders 1. Remove all log folders: (You could use rm -rf dir_name command or delete the folders manually) rm -rf /var/log/ambari-metrics-monitor rm -rf /var/log/hadoop rm -rf /var/log/hbase rm -rf /var/log/hadoop-yarn rm -rf /var/log/hadoop-mapreduce rm -rf /var/log/hive rm -rf /var/log/oozie rm -rf /var/log/zookeeper rm -rf /var/log/flume rm -rf /var/log/hive-hcatalog rm -rf /var/log/falcon rm -rf /var/log/knox rm -rf /var/lib/hive rm -rf /var/lib/oozie 2. Remove all hadoop directories: rm -rf /usr/hdp rm -rf /usr/bin/hadoop rm -rf /tmp/hadoop rm -rf /var/hadoop rm -rf /hadoop/* rm -rf /local/opt/hadoop 3. Remove all config directories: rm -rf /etc/hadoop rm -rf /etc/hbase rm -rf /etc/oozie rm -rf /etc/phoenix rm -rf /etc/hive rm -rf /etc/zookeeper rm -rf /etc/flume rm -rf /etc/hive-hcatalog rm -rf /etc/tez rm -rf /etc/falcon rm -rf /etc/knox rm -rf /etc/hive-webhcat rm -rf /etc/mahout rm -rf /etc/pig rm -rf /etc/hadoop-httpfs 4. Remove all process Id’s rm -rf /var/run/hadoop rm -rf /var/run/hbase rm -rf /var/run/hadoop-yarn rm -rf /var/run/hadoop-mapreduce rm -rf /var/run/hive rm -rf /var/run/oozie rm -rf /var/run/zookeeper rm -rf /var/run/flume rm -rf /var/run/hive-hcatalog rm -rf /var/run/falcon rm -rf /var/run/webhcat rm -rf /var/run/knox 5. Remove all zookeeper db files rm -rf /local/home/zookeeper/* 6. Remove all library folders rm -rf /usr/lib/flume rm -rf /usr/lib/storm rm -rf /var/lib/hadoop-hdfs rm -rf /var/lib/hadoop-yarn rm -rf /var/lib/hadoop-mapreduce rm -rf /var/lib/flume rm -rf /var/lib/knox 7. Remove oozie-temp folder rm -rf /var/tmp/oozie 6. Remove database Depending on what database you used for ambari, hive and oozie, just go and drop the databases created for each of these. That;s a good deal of data clean up, isn’t it? But hold on, when you will start to reinstall all these components from ambari, the components are still bound to fail and it’s pretty much guaranteed. Ask me, why? I mentioned a little something about symlinks in the very beginning of this post. That’s where all of the problem lies. Symlinks on linux systems are links to other files and directories. Now, what really happens is that we essentially deleted all the files and folders but never removed these symlinks. Now when ambari installs these components, it checks originally for the source of these symlinks and since it resides, it skips the installations of some of the required components and thus starts the whole game of bizarre problems when you thought the installations were complete and actually try to start the services in Ambari. That’s pretty much the sad story with services and components installed through ambari. Now, how to fix this part ? Solution: Ambari services and components are never completely uninstalled until we remove these symlinks originally. 1. Go to directory /etc/conf 2. Delete each of the HDP directories and components. and you are done! You can now reinstall the ambari and all its components without having to do a fresh OS install ;) . I hope that helps. P.S: Internet is a successfully thriving community from generous contributions of people from across th globe. You can help it thrive too. Please contribute. As a reader, you can be contributing with your valuable feedbacks. Please drop by a comment or Share to let people know you were here. :) :) userdel oozie userdel hive userdel zeppelin userdel ambari-qa userdel flume userdel hdfs userdel knox userdel storm userdel spark userdel mapred userdel accumulo userdel hbase userdel tez userdel zookeeper userdel kafka userdel falcon userdel sqoop userdel yarn userdel hcat groupdel spark groupdel hadoop groupdel knox groupdel hdfs groupdel zookeeper groupdel accumulo groupdel yarn groupdel mapred groupdel falcon groupdel flume groupdel hbase groupdel hive groupdel oozie groupdel sqoop groupdel storm groupdel slider groupdel livy groupdel kafka groupdel ranger groupdel operator groupdel opt1 groupdel kms groupdel zeppelin ## remove home directories cd /home rm -rf flume rm -rf hbase rm -rf hdfs rm -rf hduser rm -rf ambari-qa rm -rf accumulo rm -rf atlas rm -rf falcon rm -rf hcat rm -rf hive rm -rf infra-solr/ rm -rf kafka rm -rf kms rm -rf knox rm -rf livy rm -rf mahout rm -rf mapred rm -rf oozie rm -rf opt1 rm -rf ranger rm -rf solr rm -rf spark rm -rf sqoop rm -rf storm rm -rf tez rm -rf yarn rm -rf zeppelin rm -rf zookeeper