Skip to main content

Backup the IQ Server

Sonatype recommends that you fully document your backup process and follow a data recovery plan aligned with your company’s policies. We also recommend that you take a backup before doing an upgrade of the IQ Server. Regular backups are an important disaster recovery safeguard.

In the ideal scenario, your IQ Server configuration and database are backed up automatically and at regular intervals.

Minimum Backup

Regardless of the deployment type, the minimum required files for a full, point-in-time backup include:

Database, report files, configuration, server binary

Optional files to include:

Log files, license file, custom trust stores, cloned SCM repositories

When deciding the scope of the backup, refer to your organization's data storage policy, and remember that files used by IQ Server may have sensitive information so we recommend keeping these secure.

Backup Best Practices

Sonatype recommends a backup at least once a day of the database and new reports. The length of the complete backup depends on the database's size and the number of retained reports. In all cases, plan for a maintenance window scheduled during non-peak hours when possible.

  • The reports directory may become significantly large depending on your retention policies resulting in long-running backups. Consider performing a diff of the sonatype-work directory to only copy the changes to reports from the last backup.

  • Continuous Monitoring is configured to run at midnight and may interfere with a scheduled backup task. Consider running the backup before continuous monitoring starts as it may take a while.

  • Regularly validate your backup of IQ Server in a test environment to ensure the content has not been corrupted.

Containerized Deployments

Containerized deployments require persistent volumes. The persistent volume contains everything the service needs to run. Apply your backup strategy to your persistent volumes to ensure a complete backup.

Your organization may have a team responsible for maintaining your containerized apps. Bring them into your conversation early to ensure a repeatable backup procedure is in place.

Enterprise deployments with an external Postgres database

When using the PostgreSQL database, a full backup may be completed without shutting down the server.

  1. Copy the server application and config.yml

  2. Copy the sonatype-work directory

  3. Backup the PostgreSQL database

Your Postgres databases may be managed by a database administrator. Align with them on the timing of your backup procedures. Back up the sonatype-work and the Postgres database as close to the same time as possible or avoid data loss.

Small deployments with the embedded H2 database

The embedded H2 is an in-memory database. Performing a backup while the IQ Server is running carries the risk of copying the database in an inconsistent state. Gracefully stop the IQ Server before backing up to ensure a reliable copy is taken.

  1. Shut down the IQ Server

  2. Copy the server binary and the config.yml files

  3. Copy the sonatype-work directory

  4. Start the IQ Server

Incremental Backups

To reduce downtime, use a backup tool that allows for incremental backups. Make an initial copy of the sonatype-work directory while the service is still running. Once complete, shut down the server and run the tool again to capture the difference between the first and second copies. The second copy should run quickly.

An example of a continuous incremental backup tool is Rsync, found in Linux distributions. Start the process with:

rsync -avP <source> <dest>

Once that completes, shut down the IQ Server and run rsync again with:

rsync -avP --del <source> <dest>