Disaster recovery

Scenario 1: Stand-alone Master server

Requirements

Suppose you have a stand-alone Master server and it’s disk fails.
You will need vps backups and database backups kept intact in a safe place.
Having a backup of vps config files* and universal.php file will help in avoiding more manual work in disaster recovery.
Above files will help you in restoring vps config and panel config stored in Master and Slave settings.

*vps config files are stored under following directories :

KVM : /etc/libvirt/qemu/
XEN : /etc/xen/auto/
OpenVZ/OpenVZ 7 CT : /etc/vz/conf/
Openvz 7 VM : /etc/libvirt/qemu/
LXC : /var/lib/lxc/VID/config
VID can be found on Admin panel->List vps page.
config is the file name which stores the vps config data.

Process

1) In this case, you can re-install the OS keeping the same partitioning as it was.
Once the OS is installed, you can proceed with installing panel and then restore database :

https://www.virtualizor.com/docs/admin/restore-database/

Another way of restoring database can be seen here :

/usr/local/emps/bin/mysql -u root -p virtualizor < dumpfilename.sql

You can find dbpass (Mysql password) in /usr/local/virtualizor/universal.php file on your server.
dumpfilename.sql is your database backup file

2) Skip this step if you do not have old universal.php
After database is restored, replace new universal.php file (generated on new panel installation) with the old universal.php file which you took backup before the server was crashed.

Note : You will need to update new dbpass from new universal.php file to old universal.php file.

3) Once the database is restored and universal.php file is replaced, you can move back your vps config files to their respective directories.
If you do not have vps config files then you can click on edit/manage vps page and save it without making any changes to generate the vps config file.

4) You can then proceed in restoring vps backups :

https://www.virtualizor.com/docs/admin/restore-vps/

Scenario 2: Master-Slave cluster

Requirements

Suppose you have a Master-Slave cluster and one of your Slaves fails.

You will need vps backups kept intact in a safe place.
Having a backup of vps config files* and universal.php file will help in avoiding more manual work in disaster recovery.
Above files will help you in restoring vps config and panel config stored in Master and Slave settings.

Process

Assuming you have not forcefully removed the slave panel from Master panel, you can follow these steps:

1) In this case, you can re-install the OS on that slave keeping the same partitioning as it was.
Once the OS is installed, you can proceed with installing panel on that slave server .

2) Skip this step if you do not have old universal.php
Now , replace new universal.php file (generated on new panel installation) with the old universal.php file which you took backup before the slave server was crashed.

Note : You will need to update new dbpass from new universal.php file to old universal.php file.

3) To re-add the slave to Master panel, edit /usr/local/virtualizor/universal.php on slave server and set
correct slave’s id for : $globals[‘slave’] =
master api key value for : $globals[‘masterkey’] =
master’s ip for : $globals[‘masterip’] =

Slave’s id can be found on Master panel->Servers->List servers
Master api key can be found on Master panel->Configuration->Server Info
Master ip can be found on Master panel->Configuration->License Info->Server ip

4) Once the slave server has correct master server’s details, you can update the slave panel’s new api key pass in Master panel->Servers->List servers and edit that slave server and update there its new api key pass.
You can find new api key pass on slave panel->Configuration->Server Info.

5) Once its successfully added, you will need to run sync :

/usr/local/emps/bin/php /usr/local/virtualizor/scripts/sync_config.php

And then also go visit Master panel->Servers->List servers->Click on Manage server for that slave.
These steps will sync data to slave panel from master panel.

6) Once the database is synced to new server and universal.php file is replaced, you can move back your vps config files to their respective directories.
If you do not have vps config files then you can click on edit/manage vps page and save it without making any changes to generate the vps config file

7) You can then proceed in restoring vps backups :

https://www.virtualizor.com/docs/admin/restore-vps/

At last, you can try to create a test vps for that slave server and check.

Scenario 3: Master down in cluster

Requirements

Suppose you have a Master-Slave cluster and server with Master-only panel is permanently offline.

You will need database backup and universal.php file of your old master server which will help in restoring Master and Slave settings on new master server.

Process

Assuming you have not forcefully removed the slave panel from any manual steps :

1) In this case, you can install the OS on new server keeping the same partitioning as it was.
Once the OS is installed, you can proceed with installing panel on that new server and then restore database :

https://www.virtualizor.com/docs/admin/restore-database/

Another way of restoring database can be seen here :

/usr/local/emps/bin/mysql -u root -p virtualizor < dumpfilename.sql

You can find dbpass (Mysql password) in /usr/local/virtualizor/universal.php file on your server.
dumpfilename.sql is your database backup file

2) Skip this step if you do not have old universal.php
Now , replace new universal.php file (generated on new panel installation) with the old universal.php file which you took backup before the slave server was crashed.

Note : You will need to update new dbpass from new universal.php file to old universal.php file.

3) To re-add the slave to new Master panel, edit /usr/local/virtualizor/universal.php on slave server and set
correct slave’s id for : $globals[‘slave’] =
master api key value for : $globals[‘masterkey’] =
master’s ip for : $globals[‘masterip’] =

Slave’s id can be found on new Master panel->Servers->List servers
Master api key can be found on Master panel->Configuration->Server Info
Master ip can be found on Master panel->Configuration->License Info->Server ip

4) Once the slave server has correct master server’s details, you can update the slave panel’s new api key pass in Master panel->Servers->List servers and edit that slave server and update there its new api key pass.
You can find new api key pass on slave panel->Configuration->Server Info.

5) Once its successfully added, you will need to run sync on new master server :

/usr/local/emps/bin/php /usr/local/virtualizor/scripts/sync_config.php

And then also go visit Master panel->Servers->List servers->Click on Manage server for that slave.
These steps will sync data to slave panel from master panel.

Was this helpful to you?