Portal backup and restore
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.
Manual Backup
To manually back up the Portal:
Log in to the command line interface of the Appliance that hosts the Portal.
Execute the following script, noting that you must not add any extension to the name of the target file. The script automatically appends the
.tgz
extension to the name of the backup file:BASHThe Portal backup file is stored under:
/var/nexthink/portal/backup/
Execute the following script to backup the configuration of Nginx, the reverse proxy component in the Portal that handles connections. As in the case of the Portal, the
.tgz
extension is added automatically to the name of the backup file:BASHThe proxy backup file is stored under:
/var/nexthink/nxnginx/backup/
In addition, if you want to take a backup of the history details of count metrics, you must have configured the Portal to automatically keep these history details day by day. See in the next section the directory where the Portal stores the backup files of history details. If the Portal has not been configured to store the history details, it is not possible to recompute them afterward manually.
Copy the contents of the history directory to another location (for example, to a USB key) to make a manual backup of the history details of count metrics:
Automatic Backup
Nightly backup
Every day at 22h15, a cron job triggers an automatic backup of the Portal. Find the cron job specification under:
/etc/cron.d/portal-crontab
The backup files are located in:
/var/nexthink/portal/backup
Find the script that creates the automatic backups in the same directory:
/var/nexthink/portal/backup/backup-portal.sh
The file named portal-backup.tgz is a symbolic link that points to the last backup file in history. The backup file holds the main database of the Portal and the content of the configuration folder:
/var/nexthink/portal/conf
Specify the maximum number of local backups that are kept in the directory by editing the first variable in the script backup-portal.sh. By default, up to ten backups are kept simultaneously:
NUM_OF_BACKUPS=10
Beware that if the nightly backup script changes on a Portal release, the upgrade of the Portal 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 backup-portal.sh.rpmsave
, that the upgrade process saves in the same directory with the content of the file before the upgrade.
History backup
In addition, if you have configured your Portal to store the history details of count metrics, that is, the lists of objects that contributed to the count metric on a particular day, these are stored under:
/var/nexthink/portal/backup/history
The name of history detail files has the format history_YYYYMMDD.backup. The number of files kept for the history details depends on the disk space reserved for this purpose.
Nginx backup
Later, at 22h30, another cron job triggers the backup of the configuration of Nginx, a reverse proxy component used to enhance the security of the Portal. The automatic backup system keeps a history of up to ten backup files, which are located in:
/var/nexthink/nxnginx/backup
Find the script that creates the automatic backups of the reverse proxy here:
/var/nexthink/nxnginx/bin/backup-nxnginx.sh
Specify the maximum number of local backups that are kept in the directory by editing the first variable in the script backup-nxnginx.sh
. By default, up to ten backups are kept simultaneously:
NUM_OF_BACKUPS=10
As for the nightly script of the Portal, the backup script of Nginx may be overwritten by an upgrade of the Portal appliance and reset the number of backups to its default value, if the script changed on a release for any reason. To avoid losing your changes in such a case, recover your value for the maximum number of backups from the file backup-nxnginx.sh.rpmsav
e in the same directory.
Each backup file saves the configuration of Nginx that is located in the following directory:
/var/nexthink/nxnginx/conf.d
On upgrade backup
In addition to the nightly backups, 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/portal/backup/portal-backup_before-X.X.X.X.tgz
Older upgrade backups are erased in the process.
Because backing up the Portal may be a lengthy process, deactivate the automatic backup on the Portal upgrade if you consider that the nightly backup is enough for you to not lose important data in the case of a failed upgrade. To deactivate the automatic backup of the Portal on upgrade, create an empty file in the directory of the Portal with the following command:
Restoring the Portal
To restore the Portal state from a backup file:
Log in to the command line interface of the Appliance that hosts the Portal.
Execute the restore script:
BASH
If you saved the history details of count metrics, use the -d
option to specify the directory that holds these files. The history files are expected to have the same name format specified above (history_YYYYMMDD.backup).
In the case that you configured the Portal to save the backups and history details to an external share, this name format is changed to portal--history_YYYYMMDD-.backup. To restore the history files with the script, they must have their original name format. To rename all the history detail files stored in an external share, copy them to a directory in the Appliance and then type in the following command:
In the external share, you may have stored a set of details files whose total size exceeds the reserved disk size for history details configured in the Portal. Remember to manually select only the more recent files whose total size is within the configured limit. Use the command du -h
in the folder containing the files with history details to get their total size, compare it to the value that you have configured in the Portal data retention, and remove the oldest files in the set until the total size of the files matches or is below the configured value. Failing to do so results in the Portal taking more time to restore history details that must be removed afterward anyway, because there is no disk space left reserved for them.
The script only restores the database of the Portal, that is, the state of your dashboards. It does not restore the configuration files though, because you may want to keep your current configuration. If you need to restore the configuration of the Portal and that of Nginx:
Stop the Portal:
BASHStop Nginx:
BASHUntar the backup file of the Portal:
BASHCopy the contents of the
conf
directory to the Portal configuration directory:BASHUntar the backup file of Nginx:
BASHCopy the contents of the
conf.d
directory to corresponding Nginx directory:BASHIf you made changes to the default PKI, restore it now.
Restart Nginx:
BASHRestart the Portal:
BASH
Transitioning to the new compression algorithm
From the Portal version 6.30.7.0, the Nexthink administrators can configure the system to use an improved backup and restore process, based on the Zstandard compression algorithm.
To make the switch, follow these steps:
Log in to the command line interface of the Appliance that hosts the Portal.
Edit the Portal cron table file.
/etc/cron.d/portal-crontab
Change the
backup_script
variable tobackup-portal-zst.sh
Save the changes and exit the command line interface.
Note that there is no need to restart Portal as the file modified is part of the cron software utility.
Impact on manual backup
The procedure is the same, but instead of using backup-portal.sh
you have to use the backup-portal-zst.sh
script.
Impact on automatic backup
The only difference is the file name portal-backup-zst.tar
generated during the backup process.
Impact on manual restore
The procedure is the same, but instead of using restore-portal.sh
you have to use the restore-portal-zst.sh
script.
Also, when unpacking the backup, instead of using tar -xvzf portal-backup.tgz
use:
RELATED TASKS
RELATED REFERENCES
Last updated