Search code examples
backupnexusnexus3n3dr

Nexus 3 backup via command line?


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


Solution

  • 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.