Skip to main content

Prepare a Backup

Nexus Repository stores repository content in blob stores and keeps metadata and configuration information in the database. A backup must account for both the database and the corresponding repository data.

Plan the database and repository backups to occur at approximately the same time. This minimizes differences between the database and blob store state when you restore the deployment.

Blob Store Backup

Back up the file system or object storage that contains the Nexus Repository blobs separately from the database.

  • For File blob stores, back up the directory that contains the blobs. For a typical configuration, the blob store is located under $data-dir/blobs. The default file blob store location is part of the Nexus Repository data directory. Consider this relationship when planning backups of both the blob store and $data-dir.

  • For cloud-based persistent storage, use the backup capabilities provided by your cloud provider. For S3 blob stores, S3 replication can be used as part of a backup or disaster recovery strategy. Both the source and destination buckets must have versioning enabled to use S3 replication.

    See Backup and Restore in Amazon Web Services for AWS-specific guidance.

    For other cloud-based storage providers, refer to the provider documentation for supported backup and recovery options.

Node ID Backup

Each Nexus Repository instance is associated with a distinct ID. Back up this ID so that blob storage metrics (the size and count of blobs on disk) and Nexus Firewall reports will function when restoring or moving Nexus Repository to another server. The files to preserve the node ID are located in the following location.

$data-dir/keystores/node/

Place the files in the same location before starting Nexus Repository after a restore. See Directories for information about Nexus Repository directories.

File System Backup

Include the Nexus Repository application and data directories in your backup planning.

  • The application directory contains the Nexus Repository application and required components, including Java libraries and configuration files. The application directory is referred to as $install-dir.

  • The data directory contains repositories, components and other data stored and managed by Nexus Repository. The default data directory is ../sonatype-work/nexus3. The data directory is referred to as $data-dir. In a typical configuration, blob stores are located under $data-dir/blobs. If you back up blob stores separately, exclude $data-dir/blobs when backing up $data-dir to avoid creating duplicate backups.

Database Backup

The database that you export have pointers to blob stores that contain components and assets potentially across multiple repositories. If you don’t back them up together, the component metadata can point to non-existent blob stores. Your backup strategy must involve backing up both your databases and blob stores together to a new location in order to keep the data intact.

The database backup process depends on the database used by your deployment.

Note

For H2 database, write access is temporarily suspended until the backup is complete. Sonatype advises to schedule backup tasks during off-hours.