How to uninstall Apache Hadoop components on Linux Hortonworks HDP

In this tutorial we are going to see how we can uninstall/remove HortonWorks HDP components. Ambari is great and it offers a great management platform for your Hadoop HDP components but it has it flow and cons, one of them is uninstalling components. There is no Web-UI option that enables us this, so we are going to create our own way of doing it.

Follow this steps to uninstall all Apache Hadoop (Hortonworks HDP) components including the Ambari Server.

1. Stop all services in ambari:
Use the Ambari Web-UI to stop all services as shown below: ambari_uninstall_2
2. Remove all HDP users and their home directories
ls -1 | grep -v aodba | awk {print'"userdel -rf "$1'}
userdel -rf ambari-qa
userdel -rf ams
userdel -rf atlas
userdel -rf falcon
userdel -rf hbase
userdel -rf hcat
userdel -rf hdfs
userdel -rf hive
userdel -rf mapred
userdel -rf oozie
userdel -rf sqoop
userdel -rf tez
userdel -rf yarn
userdel -rf zookeeper
3. Remove all Hadoop  packages including Ambari server and agent.
  • use the yum tools for this task.
yum remove hive\* oozie\* pig\* zookeeper\* tez\* hbase\* ranger\* knox\* storm\* hadoop\* -y 
ambari-server stop  yum erase ambari-server -y
ambari-agent stop  yum erase ambari-agent -y
4. Remove all log directories of the Hadoop Services.
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
5. 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
6.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
7.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
8.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
9.Remove oozie/sqoop temp folders
rm -rf /var/tmp/oozie
rm -rf /var/tmp/sqoop
10. delete the database you used for ambari, hive and oozie
yum remove mysql\* postgresql\* -y