847-505-9933 | +91 20 66446300 info@datametica.com

Migration of Ambari server

Ambari is Hortonworks Hadoop cluster management framework. It helps monitor Hadoop ecosystem services.
This article shows the procedure to migrate the Ambari server in a production cluster. Currently, you might have your Ambari server setup using default DB, which is PostgresSQL.
Before starting the migration, the Ambari server has to be down, which will make the Management UI unavailable but the services will continue running in the background. You must plan the migration accordingly.

Prerequisites
Ensure that passwordless ssh is setup between new Ambari server and other hosts in cluster
Update the /etc/hosts file with information of all hosts in the cluster
Install Java
Configure HDP and Ambari repository

To Migrate the Ambari server

1. Stop Ambari server.
ambari-server stop

2. We need to back up the Ambari database for migration. In production environments, ideally backups should be scheduled daily or 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

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 previous ambari server’s backup.

ambari-server stop

7. Service postgresql restart.

8. Log in 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 to ensure that DBs have been dropped.

/list

11. Create new DBs to restore the old backup into them.

create database ambari;
create database ambarirca;

12. Check to ensure that 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://:8080

18. Restart a service (for example, MapReduce) using the Management UI to verify it works.

Now, you have successfully migrated Ambari server to a new host and restored it to its original state.

Arti Wadhwani
Sr. Engineer
Big Data Platform
DataMetica

Leave a Comment

POST COMMENT Back to Top
*
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.