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.
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
Configure HDP and Ambari repository
To Migrate the Ambari server
1. Stop Ambari server.
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
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.
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.
7. Service postgresql restart.
8. Log in to postgresql terminal:
su – postgres
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.
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.
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.
17. Open the Ambari Web UI.
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.
Big Data Platform