Tag : ambari-server-migration

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.

 

ambari

 

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! :)

facebooktwittergoogle_plusredditpinterestlinkedinmailby feather