Engine backup and restore
Manual backup
To make a complete backup of the Engine, execute manually the same script that is executed automatically during the daily backup of the Appliance:
Log in to the CLI of the Appliance running the Engine.
Execute the command:
BASHOptionally: If you want to keep the logs, copy the log files stored under:
/var/log/nexthink/
engine.log
audit.log
alert.log
All the compressed older logs stored in gz files.
For the Engine in the Appliance, the script creates a tgz file (GZIP compressed Tar archive format) with the contents of the Engine database and its configuration. Find the backup files under:
/var/nexthink/engine/01/backups/nxengine-backup-<id>.tgz
Alternatively, you can make a backup of the Engine database only. Copying the database file while the Engine is running is not a good idea, because the Engine is continuosly modifying the file, and the result could be a corrupted file. Instead, make a safe backup while your Engine is running by following these steps:
Log in to Command Line Interface of the Appliance.
Execute the following command to generate a compressed gz file with the database of the Engine:
BASH
The file is copied to your current directory.
Automatic backup
The Appliance automatically makes a backup of all the Engines running on it via a cron job. The job is executed every day at 04h15 by default. Find the cron job specification under:
/etc/cron.d/nxengine-crontab
And the script executed in here:
/var/nexthink/engine/common/bin/nightly_backup.sh
The script makes a copy of the database and the configuration files of the Engine that is present in the Appliance and compresses them in separate tgz files. Backup files are stored in the Engine backup directory:
/var/nexthink/engine/01/backups/nxengine-backup-<ig>.tgz
Specify the maximum number of local backups that are kept in the directory by editing the first variable in the script nightly_backup.sh. By default, up to ten backups are kept simultaneously:
NUM_OF_BACKUPS=10
Beware that if the nightly backup script changes on an Engine release, the upgrade of the Engine resets the number of backups to its default value. In such a case, recover your own modified number of backups from a copy of the script, named nightly_backup.sh.rpmsave
, that the upgrade process saves in the same directory with the contents of the file before the upgrade.
In a test environment, you may want to disable automatic backups to save disk space in the Appliance. To that end, comment out the line that executes the nightly backup in the crontab file by prepending a hash sign (#) to it.
Each local backup file gets assigned a number from one to the maximum number of simultaneous backups in the directory. When the maximum number is reached, the count begins again and backup files are progressively overwritten. In order to get the most recent backup file, there is a symbolic link to the latest backup (note the absence of identifier):
/var/nexthink/engine/01/backups/nxengine-backup.tgz
If external backups have been activated, the automatic script copies the daily backup to external storage right after generating it.
On upgrade backup
In addition to the automatic nightly backup of the Engine, the appliance automatically makes a new backup of the Portal before each upgrade. The file is placed in the same directory as the nightly backups and its name has the following format (where X.X.X.X indicates the version to which the Portal is upgrading):
/var/nexthink/engine/01/backups/nxengine-backup_before-X.X.X.X.tgz
Older upgrade backups are erased in the process.
Restoring the Engine
Restore the Engine either in the same Appliance from which you made the backups or in a different Appliance. In the case that you are restoring your backups in another Appliance, make sure that its network configuration is the same as the configuration of the original Appliance. Otherwise, you may no longer receive data from the Collectors and have the wrong internal networks configured. In addition, the new Appliance requires you to reallocate the devices assigned to the original Appliance from the Portal. In case that you are using a license with online activation, this process should be transparent. If you are using a license with offline activation, you must repeat the procedure to get your license signed.
To restore a complete backup of the Engine:
Log in to CLI of the Appliance where you want to restore the Engine.
Stop the running Engine:
BASHCopy the backup file into the Engine directory:
BASHExtract the database and configuration files from the backup file:
BASHIf you are restoring a database from an Engine previous to V6.5, change the owner and mode of the restored configuration files:
BASH
Remove the database of the Engine in place:
BASHRestore the database of the Engine backup:
BASHRestart the Engine:
BASHValidate that the Engine is running properly:
BASH
While the Engine is starting, the last command displays the message:
nxengine is booting...
After a few minutes, once the Engine has finished loading the database, the execution of this command displays the basic configuration and some statistics of the Engine. This means that the restore process was successful.
If you made a backup of the database only and you want to restore it in the current Appliance, you just need to restore the database of the Engine, and not any of the configuration files, which are already in place:
Log in to CLI of the Appliance where you want to restore the Engine.
Stop the running Engine:
BASHRemove the database of the Engine in place:
BASHRestore the database of the Engine backup:
BASHRestart the Engine:
BASHValidate that the Engine is running properly:
BASH
The operations described in this article should only be performed by a Nexthink Engineer or a Nexthink Certified Partner.
If you need help or assistance, please contact your Nexthink Certified Partner.
RELATED TASKS
RELATED REFERENCE
Last updated