5

In Nexus 3 backup procedure has changed.

In Nexus 2 recommended was to run a OS scheduled task / cron job to rsync some directories to a backup location.

In Nexus 3 the recommended way seems to be to create to schedule a predefined Nexus Task Export configuration & metadata for backup Task. And then also create a cron job to backup what gets exported with this task.

Is it still possible in Nexus 3 to do a old style backup? Shutdown the server and backup certain directories? And then for restore just put everything back? Will that work?

Or use a command line to run this task?

The way this is done in Nexus 3 does not seem to be thought through very well. You need to do a lot more to do what could be done with a single cron job in Nexus 2:

  1. Create a scheduled task to export data.
  2. Create a cron job to backup exported data.
  3. Make sure that scheduled task runs and finished before the cron job.

See for example https://help.sonatype.com/display/NXRM3/Restore+Exported+Databases

See also Nexus Repository 3 backup

030
  • 10,842
  • 12
  • 78
  • 123
onknows
  • 6,151
  • 12
  • 65
  • 109
  • Does this answer your question? [How to backup all Nexus 3 artifacts?](https://stackoverflow.com/questions/46467106/how-to-backup-all-nexus-3-artifacts) – 030 May 19 '21 at 12:25

3 Answers3

4

If you back up the entire data (sonatype-work) directory this should work as you wish. However, since the data directory is large and has many moving parts, it is safer to use the task, otherwise you may get copies of things in motion which could then corrupt and your backup would not work. The copy of the work directory as far as I know is only recommended for servers that are down, which isn't an option for many bigger companies.

joedragons
  • 2,505
  • 21
  • 21
1

Copying the entire folder did not work for me and resulted in orientdb problems. Last year I started to create N3DR. Version 3.5.0 has just been released.

030
  • 10,842
  • 12
  • 78
  • 123
0

https://help.sonatype.com/plugins/servlet/mobile?contentId=5412146#content/view/5412146

In case link becomes bad etc. (From Oct 20, 2017)


Nexus Repository stores data in blob stores and keeps some metadata and configuration information separately in databases. You must back up the blob stores and metadata databases together. Your backup strategy should involve backing up both your databases and blob stores together to a new location in order to keep the data intact.

Complete the steps below to perform a backup:

Blob Store Backup

You must back up the filesystem or object store containing the blobs separately from Nexus Repository.

  • For File blob stores, back up the directory storing the blobs.

    • For a typical configuration, this will be $data-dir/blobs.
  • For S3 blob stores, you can use bucket versioning as an alternative to backups. You can also mirror the bucket to another S3 bucket instead.

For cloud-based storage providers (S3, Azure, etc.), refer to their documentation about storage backup options.

Node ID Backup

Each Nexus Repository instance is associated with a distinct ID. You must back up this ID so that blob storage metrics (the size and count of blobs on disk) and Nexus Firewall reports will function in the event of a restore / moving Nexus Repository from one server to another. The files to back up to preserve the node ID are located in the following location (also see Directories):

$data-dir/keystores/node/​

To use this backup, place these files in the same location before starting Nexus Repository.

Database Backup

The databases 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. So, your backup strategy should involve backing up both your databases and blob stores together to a new location in order to keep the data intact.

Here’s a common scenario for backing up custom configurations in tandem with the database export task:

  1. Configure the appropriate backup task to export databases:
  • Use the Admin - Export databases for backup task for OrientDB databases

  • Use the Admin - Backup H2 Database task for H2 databases PRO

  1. Run the task to export the databases to the configured folder.
  2. Back up custom configurations in your installation and data directories at the same time you run the export task.
  3. Back up all blob stores. Store all backed up configurations and exported data together.

Write access to databases is temporarily suspended until a backup is complete. It’s advised to schedule backup tasks during off-hours.

pbsladek
  • 616
  • 7
  • 12