How to do a data migration between two DNSManager servers
This article explains how to perform data migration between two DNSManager servers avoiding the XML export - import option from the web interface. The indications included here are recommended in case you want to move your installation onto a new server, or if your server suffered a failure and you want to import your data on a new server.
Step-by-step guide
To migrate DNS Manager between two servers, follow the steps below and keep in mind that this operation can only be done manually.
There are two ways you can perform a migration:
- from the web interface, using the XML export option on the source server and then the XML import for the destination server
- using the latest database dump created by the dbdump script
Back up the Database
- On the old server, run the
/usr/local/dnsmanager/bin/dbdump script. This will perform a full database backup. - Once it's complete, the file
/var/lib/dnsmanager/dumps/dnsmanagerwmysql.daily.dump.0.gzshould be copied to the new server in the /root directory.
The dbdump script uses the /etc/dnsmanager/dnsmanager.conf file to read the location of the backups. By default DUMPS_D from local.conf is set to /var/lib/dnsmanager/dumps.
In case this was modified, please note that the database backup will no longer be carried out in /var/lib/dnsmanager/dumps/dnsmanagermysql.daily.dump.0.gz.
Get database login from old server
The database login username is taken from the /etc/dnsmanager/dnsmanager.conf using the following command:
cat /etc/dnsmanager/dnsmanager.conf | grep DB_USER | awk '{print $2}'The output of that command will be called OLD_DB_USER.
Set up the new server
If you haven't already installed the latest version of DNSManager, do it now using the Command Line Installer.
Once installed, take the following steps:
Obtain the value below. This value will be called
NEW_DB_USER.bashcat /etc/dnsmanager/dnsmanager.conf | grep DB\_USER | awk '{print $2}'Unzip database backup from /root.
bashgzip -d dnsmanagermysql.daily.dump.0.gzChange user in the dump.
bashsed -i 's/OLD_DB_USER/NEW_DB_USER/g' dnsmanagermysql.daily.dump.0Replace
OLD_DB_USERwithDB_USERvalue from the old server andNEW_DB_USERwithDB_USERvalue from the new server.Log in to MySQL using the following command:
bashmysql -u`cat /etc/dnsmanager/dnsmanager.conf |grep DB_USER | awk '{print $2}'` -p`cat /etc/dnsmanager/dnsmanager.conf | grep DB_PASSWD | awk '{print $2}'`Then execute this:
bashDROP DATABASE dnsmanager; CREATE DATABASE dnsmanager; quitLoad the old database.
bashmysql --force -u`cat /etc/dnsmanager/dnsmanager.conf |grep DB_USER | awk '{print $2}'` -p`cat /etc/dnsmanager/dnsmanager.conf | grep DB_PASSWD | awk '{print $2}'` --default-character-set=utf8 dnsmanager < dnsmanagermysql.daily.dump.0In case you migrate form an old version, you need to run mysql_upgrade utility.
bashmysql_upgrade -u`cat /etc/dnsmanager/dnsmanager.conf |grep DB_USER | awk '{print $2}'` -p`cat /etc/dnsmanager/dnsmanager.conf | grep DB_PASSWD | awk '{print $2}'` --forceForce install dnsmanager-core.
bashyum -c /etc/dnsmanager-yum.conf reinstall dnsmanager-coreRestore zone files from the database:
bash/usr/local/dnsmanager/admin/sbin/zonemng -rRestart dnsmanager, named, zonemngd and updateurld and that should be it.