Database management

Database backup

Rebel Licenses On-Premise database backups are recommended. Database integrity can not be guaranteed in case of local hardware failure. Regular backup processes are highly recommended. In addition, it is recommended to back up the database before upgrading Rebel Licenses On-Premise!

Warning

Do not attempt copying the database file when the Rebel Licenses On-Premise is running! Doing so risks database corruption.

There are two safe ways to create a backup copy of the database while the Rebel Licenses On-Premise is running.

Creating a backup using the GUI

Database backup can be performed via the Configuration page.

../_images/database-backup-gui.png

Creating a backup using the REST API

Use the following REST API action for periodical automated backups.

GET /api/admin/backup-database?token=<my authentication token>

You will receive a JSON response, indicating database backup success and the backup path.

{
  "result":true,
  "backupFilePath":"/opt/jr-license-server/./data-backup/db/db-2015-10-17_12-04-57.zip"
}

Restoring the database from a backup

  1. Safely shut down Rebel Licenses On-Premise.

  2. Overwrite the database file db.h2.db in $LS/data/db/ folder using your backup file.

  3. Restart Rebel Licenses On-Premise.

Compacting the database

Rebel Licenses On-Premise uses an H2 database engine that is backed up by a file system file. When the database usage intensifies, the file size can increase. H2 often appends data to the end of the file – instead of utilizing free space in the middle parts of the file. This leads both to increased storage uptake as well as affecting Rebel Licenses On-Premise performance. To combat this, H2 features internal database file compacting. This cannot be performed during runtime. The compacting is instead performed during a short period when the JVM has received a shutdown command. Rebel Licenses On-Premise has set the default time for compacting the database to 6000 milliseconds. This default can be overridden using the JVM argument -Drebel.ls.maxCompactTime. All values are provided in milliseconds.

The default value has been set to prevent accidental cancellation. It is recommended to allow H2 to run this procedure for a longer period, e.g. 20 seconds. To do this, configure the value as follows:

./bin/license-server.sh start -Drebel.ls.maxCompactTime=20000

Please shut down and restart Rebel Licenses On-Premise occasionally. Make sure to use the Polite shutdown procedure. Not using the polite shutdown skips database compacting. Using arbitrary shutdown can also corrupt the database.