To transfer an Ambari Server that uses the default, embedded, PostgreSQL database from one host to a new host, use the following instructions:
Back up current data - from the original Ambari Server database.
Update all Agents - to point to the new Ambari Server.
Install the New Ambari Server - on the new host and populate databases with information from the original Server.
Note If your Ambari Server is using one of the non-default databases (such as MySQL, Oracle, or an existing PostgreSQL instance) then be sure to follow backup, restore, and stop/start procedures that match that database type.
Back up Current Data
On the Ambari Server host, stop the original Ambari Server.
1
ambari-server stop
Create a directory to hold the database backups.
1 2 3 4 5
cd /tmp
mkdir dbdumps/
cd dbdumps/
Create the database backups.
1 2 3 4 5
pg_dump -U {ambari.db.username} -f ambari.sql
Password: {ambari.db.password}
where the following:
Variable
Description
Default
ambari.db.username
The database username.
ambari
ambari.db.password
The database password.
bigdata
4.Create a backup of the Ambari Server meta info.
1
ambari-server backup
Update all Agents
On each agent host, stop the agent.
1
ambari-agent stop
Remove old agent certificates (if any exist).
1
rm /var/lib/ambari-agent/keys/*
Using a text editor, edit /etc/ambari-agent/conf/ambari-agent.ini to point to the new host.
1 2 3 4 5 6 7
[server]
hostname={new.ambari.server.fqdn}
url_port=8440
secured_url_port=8441
Install the New Ambari Server
Install the new Ambari Server on the new host.
1
yum install ambari-server
Run setup the Ambari Server and setup similar to how the original Ambari Server is configured.
1
ambari-server setup
Restart the PostgreSQL instance.
1
service postgresql restart
Open the PostgreSQL interactive terminal.
1 2 3
su - postgres
psql
Using the interactive terminal, drop the “ambari” database created by the new ambari setup and install.
1
drop database ambari;
Check to make sure the databases have been dropped. The “ambari” databases should not be listed.
1
\l
Create new “ambari” database to hold the transferred data.
1
create database ambari;
Exit the PostgreSQL interactive terminal.
1
\q
Copy the saved data (/tmp/dbdumps/ambari.sql) from Back up Current Data to the new Ambari Server host.
Load the saved data into the new database.
1
psql -d ambari -f /tmp/dbdumps/ambari.sql
Start the new Server.
1
ambari-server start
On each Agent host, start the Ambari Agent.
1
ambari-agent start
Open Ambari Web. Point your browser to:
1
<new.Ambari.Server>:8080
The new Ambari Server is ready to use.
Q&A
ambari-agent.log WARNING or ERROR
1 2
WARNING 2016-12-14 16:17:57,842 NetUtil.py:89 - Failed to connect to https://ambari-test-3:8440/ca due to [Errno -2] Name or service not known WARNING 2016-12-14 16:17:57,842 NetUtil.py:112 - Server at https://ambari-test-3:8440 is not reachable, sleeping for 10 seconds...