Migration of Ambari server in Hortonworks Hadoop 2.2
There could be various scenarios in which migration of Hortonworks Management server (Ambari server) is required. For instance, due to hardware issues with server etc.
In this article we will discuss migration of Ambari server in Hortonworks Hadoop in production cluster. Assuming that your Ambari server has been setup using default DB which is PostgresSQL.
PS: This requires Ambari server downtime. This means that the Management UI won’t be available but the services will continue running in background. Plan accordingly.
Prerequisites :
· Please ensure that passwordless ssh is setup between new ambari server and other hosts in cluster.
· Also, the /etc/hosts file should be updated with info of all hosts in the cluster.
· Java must be installed.
· HDP and ambari repo must be configured.
This is not a long exercise. So let us begin 
1. Stop ambari-server.
ambari-server stop
2. Now we need to backup the Ambari database for migration. In production environments, ideally backups should be scheduled daily/weekly to prevent loss in case of irrecoverable server crash.
- make a directory to store your backup :
mkdir /tmp/ambari-db-backup cd /tmp/ambari-db-backup
- Backup Ambari DB:
pg_dump -U $AMBARI-SERVER-USERNAME ambari > ambari.sql Password: $AMBARI-SERVER-PASSWORD pg_dump -U $MAPRED-USERNAME ambarirca > ambarirca.sql Password: $MAPRED-PASSWORD
Note : Defaults for $AMBARI-SERVER-USERNAME is ambari-server, $AMBARI-SERVER-PASSWORD is bigdata, $MAPRED-USERNAME is mapred and $MAPRED-PASSWORD is mapred.
These values are configured while ambari-server setup.
3. Stop ambari-agent on each host in the cluster
ambari-agent stop
4. Edit /etc/ambari-agent/conf/ambari-agent.ini and update the hostname to point to the new ambari-server host.
5. Install the ambari-server on the new host.
yum install ambari-server
6. Stop this new ambari server so that we can restore it from the backup of old.
ambari-server stop
7. service postgresql restart
8. Login to postgresql terminal :
su - postgres psql
9. Drop the newly created DB setup while installing ambari on new host.
drop database ambari; drop database ambarirca;
10. Check DBs have been dropped.
/list (You have to execute this command in psql teminal)
11. Now create new DBs to restore the old backup into them.
create database ambari; create database ambarirca;
12. Check DBs have been created.
/list
13. Exit psql prompt
14. Copy the DB backup from old to new ambari host by using scp.
15. Restore DB on new ambari host from backup. PS : you are still logged in as postgres user for this.
psql -d ambari -f /tmp/ambari.sql psql -d ambarirca -f /tmp/ambarirca.sql
16. Start ambari-server as root now.
ambari-server start
17. Open the Ambari Web UI
http://<new ambari host>:8080 (Open in your favorite browser)
18. Restart a service (say MapReduce) using the Management UI to verify all is working fine.
Done! We have successfully migrated Ambari server to a new host and restored it to its original state. Enjoy! 








Thanks for sharing your experiences with others. You’re really making a difference.
Thank you for your valuable feedback!
I love what you guys are usually up too. This type of clever work
and reporting! Keep up the superb works guys I’ve incorporated you guys
to my own blogroll.
Thanks Shela!
If you desire to get a great deal from this piece of writing
then you have to apply such strategies to your won website.
Thanks Darell.
I’m not sure why but this weblog is loading incredibly
slow for me. Is anyone else having this issue or is it a problem on my end?
I’ll check back later on and see if the problem
still exists.
Is it still a problem, Tobias?
We are a group of volunteers and opening a new scheme in our community.
Your website offered us with valuable info to work on. You have done an impressive job
and our entire community will be thankful to you.
Hurrah, that’s what I was looking for, what
a stuff! existing here at this website, thanks admin of this web site.
Keep this going please, great job!
Thanks!
Great article, just what I needed.
Hello to every , because I am truly keen of reading this blog’s
post to be updated on a regular basis. It includes pleasant information.
Im thankful for the blog.Really thank you! Fantastic.
Wow, great article. Really Great.
I really like and appreciate your blog.Really thank you! Fantastic.
wow, awesome blog post.Thanks Again. Keep writing.
Thanks a lot for sharing!
Im thankful for the article.Thanks Again. Keep writing.
Major thankies for the blog article.Much thanks again. Much obliged.
I think this is a real great blog.Really thank you! Cool.
I just want to say I am just new to blogging and site-building and certainly liked this blog. More than likely I’m likely to bookmark your blog post . You surely have terrific posts. Thanks a bunch for revealing your web-site.
I value the article.Really looking forward to read more. Will read on…