5.2.8.2. ON Core Restore
After going through a highly critical hardware failure, we may need to recover the ON Server from one from one of its previous backups.
Procedure:
- Recover the openNAC server by either:
Restoring its latest snapshot from within your virtualizer;
Redeploying from an OVA with the same version or newer;
Stop all the services:
systemctl stop httpd
systemctl stop gearmand
systemctl stop radiusd
systemctl stop opennac
Unpack the backup tarball:
Important
Make sure that the mount point where you are extracting the files has enough space to support the uncompressed files.
mkdir /tmp/restore
cd /backup/
tar -xvzf opennac-<hostname>-<backup_date>_<backup_time>.tgz -C /tmp/restore
cd /tmp/restore/
cd var/log/opennac/backup
gzip -d opennac-db-backup-*.sql.gz
This is what we will get from the backup tarball:
[root@opennac restore]# ls -l
drwxr-xr-x 96 root root 12288 Feb 23 03:25 etc
drwxr-xr-x 3 root root 4096 Feb 27 16:00 usr
drwxr-xr-x 3 root root 4096 Feb 27 16:00 var
[root@opennac restore]# ls -l var/log/opennac/backup
-rw-r--r-- 1 root root 3107605 Feb 26 23:26 opennac-db-backup-v1.0.rc1.5913-20180226_232601.sql
Restore OpenNAC Enterprise data:
cd /tmp/restore
rm /usr/share/opennac.old
mv /usr/share/opennac /usr/share/opennac.old
cp -a usr/share/opennac /usr/share
mysql -u ${mysql_root} -p${mysql_root_password} opennac < var/log/opennac/backup/opennac-db-backup*.sql
Check that the ON Core Services are configured as the backup. This information can be found in ON Core basic configuration.
Restart OpenNAC Enterprise services:
/usr/share/opennac/utils/scripts/restartOpenNACServices.sh
When you are sure that everything is restored and working fine, delete restore backup directory:
rm -rf /tmp/restore
Warning
If we are restoring the backup on a new server, we have to keep in mind that the MySQL credentials will be the default ones and we will not be able to access them if they are modified in the original installation.
To restore said configuration and ensure the operation of the service, it will be necessary to execute the MySQL password configuration script with the necessary credentials:
/usr/share/opennac/utils/scripts/opennac_mysql_password_change.sh