Support Questions

Find answers, ask questions, and share your expertise

How to Completely Clean, Remove or Uninstall Ambari for Fresh Install

avatar

Sometimes when installing Ambari run repos are downloaded or there are maybe issues with python.

1 ACCEPTED SOLUTION

avatar

Which user is ambari running under?

ps aux | grep ambari-server
rpm -qa | grep ambari

Try the following steps: On the master node

ambari-server stop
ambari-server reset
ambari-agent stop
yum erase ambari-server

rm -rf /var/lib/ambari-server

rm -rf /var/run/ambari-server

rm -rf /usr/lib/ambari-server

rm -rf /etc/ambari-server

rm -rf /var/log/ambari-server

rm -rf /usr/lib/python2.6/site-packages/ambari*

Reinstall Ambari server

yum install ambari-server  

ambari-server start

On each worker node:

ambari-agent stop 

yum erase ambari-agent 

rm -rf /var/lib/ambari-agent

rm -rf /var/run/ambari-agent

rm -rf /usr/lib/amrbari-agent

rm -rf /etc/ambari-agent

rm -rf /var/log/ambari-agent

rm -rf /usr/lib/python2.6/site-packages/ambari*

Then try re-running the install of Ambari Agent

yum install ambari-agent

vi /etc/ambari-agent/conf/ambari-agent.ini

#Change hostname to Ambari Server 

ambari-agent start

———————————————

- check logs

/var/log/ambari-agent/ambari-agent.log

/var/log/ambari-server/ambari-server.log

before starting the cluster install, see if the hosts have actually registered themselves (if doing it by updating ambari-agent.ini)

—————————

Troubleshooting

You can start ambari in debug mode to get more detailed aoutput via:

ambari-server start --verbose --debug

# or for short

ambari-server start -v -g

Significant files/directories:

  • /var/log/ambari-server/ambari-server.log (for ambari server)
  • /var/log/ambari-agent/ambari-agent.log (for ambari agens)
  • /var/lib/ambari-agent/data/ (server action output)

SQL scripts to initialize psql DB

  • /var/lib/ambari-server/resources/

Uninstall Postgres and move the redundant Ambari database file out of the way

yum remove postgres*

userdel -fr postgress

mv /var/lib/pgsql /var/lib/old.pgsql

View solution in original post

9 REPLIES 9

avatar

Which user is ambari running under?

ps aux | grep ambari-server
rpm -qa | grep ambari

Try the following steps: On the master node

ambari-server stop
ambari-server reset
ambari-agent stop
yum erase ambari-server

rm -rf /var/lib/ambari-server

rm -rf /var/run/ambari-server

rm -rf /usr/lib/ambari-server

rm -rf /etc/ambari-server

rm -rf /var/log/ambari-server

rm -rf /usr/lib/python2.6/site-packages/ambari*

Reinstall Ambari server

yum install ambari-server  

ambari-server start

On each worker node:

ambari-agent stop 

yum erase ambari-agent 

rm -rf /var/lib/ambari-agent

rm -rf /var/run/ambari-agent

rm -rf /usr/lib/amrbari-agent

rm -rf /etc/ambari-agent

rm -rf /var/log/ambari-agent

rm -rf /usr/lib/python2.6/site-packages/ambari*

Then try re-running the install of Ambari Agent

yum install ambari-agent

vi /etc/ambari-agent/conf/ambari-agent.ini

#Change hostname to Ambari Server 

ambari-agent start

———————————————

- check logs

/var/log/ambari-agent/ambari-agent.log

/var/log/ambari-server/ambari-server.log

before starting the cluster install, see if the hosts have actually registered themselves (if doing it by updating ambari-agent.ini)

—————————

Troubleshooting

You can start ambari in debug mode to get more detailed aoutput via:

ambari-server start --verbose --debug

# or for short

ambari-server start -v -g

Significant files/directories:

  • /var/log/ambari-server/ambari-server.log (for ambari server)
  • /var/log/ambari-agent/ambari-agent.log (for ambari agens)
  • /var/lib/ambari-agent/data/ (server action output)

SQL scripts to initialize psql DB

  • /var/lib/ambari-server/resources/

Uninstall Postgres and move the redundant Ambari database file out of the way

yum remove postgres*

userdel -fr postgress

mv /var/lib/pgsql /var/lib/old.pgsql

avatar
Master Mentor

@amcbarnett@hortonworks.com

https://gist.github.com/nsabharwal/f57bb9e607114833df9b

Important

Ambari reinstall will give you following command while running check during the cluster install. It will save you lot of time

I run with --skip=users

python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent --skip=users

avatar

avatar
Expert Contributor

There you go! Here's the solution to your problem. I struggled with this for like weeks and tried uninstalling and reinstalling over and over and then finally decided to share it here : How to completely remove and uninstall HDP

avatar
New Contributor

Hi, the link seems broken. Can you share with us the working one? Thanks.

avatar
Explorer

I noticed couple of typos. be mindful if you are running them in batch

rm -rf /usr/lib/amrbari-server

rm-rf /usr/lib/python2.6/site-packages/ambari*

avatar
Rising Star
@Ancil McBarnett

will your above solution delete the existing HDP installation also ?

avatar

No it doesn't. You have to run additional scripts to delete HDP

avatar
Expert Contributor

One of Powerful clean up by below python script on hadoop , It clean all directory , including user and files

[root@.ssh]# python /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py --silent
INFO:HostCleanup:
Killing pid's: ['']

INFO:HostCleanup:Deleting packages: ['']

INFO:HostCleanup:
Deleting users: ['ams', 'ambari-qa', 'yarn', 'mapred', 'tez', 'hbase', 'sqoop', 'oozie', 'falcon', 'flume', 'hive', 'hcat']
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf ams
INFO:HostCleanup:Successfully deleted user: ams
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf ambari-qa
INFO:HostCleanup:Successfully deleted user: ambari-qa
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf yarn
INFO:HostCleanup:Successfully deleted user: yarn
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf mapred
INFO:HostCleanup:Successfully deleted user: mapred
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf tez
INFO:HostCleanup:Successfully deleted user: tez
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf hbase
INFO:HostCleanup:Successfully deleted user: hbase
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf sqoop
INFO:HostCleanup:Successfully deleted user: sqoop
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf oozie
INFO:HostCleanup:Successfully deleted user: oozie
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf falcon
INFO:HostCleanup:Successfully deleted user: falcon
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf flume
INFO:HostCleanup:Successfully deleted user: flume
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf hive
INFO:HostCleanup:Successfully deleted user: hive
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh userdel -rf hcat
INFO:HostCleanup:Successfully deleted user: hcat
INFO:HostCleanup:Executing command: /var/lib/ambari-agent/ambari-sudo.sh groupdel hadoop
WARNING:HostCleanup:Cannot delete group : hadoop, groupdel: cannot remove the primary group of user 'hduser'
INFO:HostCleanup:Path doesn't exists: /home/ams
INFO:HostCleanup:Path doesn't exists: /home/ambari-qa
INFO:HostCleanup:Path doesn't exists: /home/yarn
INFO:HostCleanup:Path doesn't exists: /home/mapred
INFO:HostCleanup:Path doesn't exists: /home/tez
INFO:HostCleanup:Path doesn't exists: /home/hbase
INFO:HostCleanup:Path doesn't exists: /home/sqoop
INFO:HostCleanup:Path doesn't exists: /home/oozie
INFO:HostCleanup:Path doesn't exists: /home/falcon
INFO:HostCleanup:Path doesn't exists: /home/flume
INFO:HostCleanup:Path doesn't exists: /home/hive
INFO:HostCleanup:Path doesn't exists: /home/hcat
INFO:HostCleanup:Deleting file/folder: /tmp/Jetty_0_0_0_0_60010_master____q3nwom
INFO:HostCleanup:Deleting file/folder: /tmp/Jetty_0_0_0_0_34300_mapreduce____.dx7bll
INFO:HostCleanup:Deleting file/folder: /tmp/hbase-hbase
INFO:HostCleanup:Deleting file/folder: /tmp/Jetty_0_0_0_0_34025_mapreduce____jgsznr
INFO:HostCleanup:Deleting file/folder: /tmp/Jetty_centos4_test_com_8088_cluster____.cl0kmf
INFO:HostCleanup:Deleting file/folder: /tmp/Jetty_0_0_0_0_8042_node____19tj0x
INFO:HostCleanup:
Deleting directories: ['']
INFO:HostCleanup:Path doesn't exists:
INFO:HostCleanup:
Deleting repo files: []
INFO:HostCleanup:
Erasing alternatives:{'symlink_list': [''], 'target_list': ['']}

INFO:HostCleanup:Path doesn't exists:
INFO:HostCleanup:Clean-up completed. The output is at /var/lib/ambari-agent/data/hostcleanup.result