Moving a Nexus Repo 3 Installation to a New Location

 To move a Nexus Repo 3 server to a new location you'll need to move three main things:

  1. The application directory (e.g. nexus-3.13.0-01)
  2. The data directory (e.g. sonatype-work/nexus3 )
  3. Blob storage

Application Directory

The application directory of a Nexus Repo 3 installation is portable*, and can simply be copied to the new location. Be sure to preserve operating system file permissions when doing this. 

Data Directory

The data directory ( commonly referred to as $data-dir or ${} ) of a Nexus Repo 3 installation is portable*, and can just be copied to a new location.   If you're not sure where the data directory of your installation is located, we have an article that can help you

It is safe to skip moving the following directories within the $data-dir:

  • elasticsearch ( copying this at any point while NXRM is running will cause failures in the target, we have seen cases where moved search indexes do not work on a new host, one can use tasks to rebuild Search indexes once the new instance is started )
  • cache - temporary files instance specific
  • logs - logs should be kept instance specific
  • tmp - temporary files instance specific

Blob Stores

Blob stores are also portable, and can be copied to a new location. 

File based blob stores: To find the location of your blob stores go to "repository --> blob stores" in the Nexus Repo 3 administration UI.  If the path shown for a blob store is not an absolute path, that means it is located at a relative directory under $data-dir/blobs/, and it will be copied when you copy the entire data directory.

General Advice

Note that the directories must be copied when Nexus Repo is not running. But to minimize downtime, consider using a backup tool that can perform incremental file system backups. One commonly used tool which can do this is the "rsync" program that can be found in Linux distributions.

When using a backup tool that can perform incremental backups an initial copy of the directories can be done while the original Nexus Repo 3 is still running.  If you're using rsync, this can be done with "rsync -avP <source> <dest>".  Once this completes, shut down Nexus Repository Manager, and run a second copy using "rsync -avP --del <source> <dest>".  This second copy should run quite quickly, since rsync will only be handling the delta of files between the first and second copy.

If your original system has a slow disk consider running the first rsync with "ionice -c3 rsync". This will prevent rsync from consuming all disk bandwidth.

If your blob stores are not going to be in the same location as they were in the original system running Nexus Repo you'll need to update their locations in the database.  See here for information on how to do this:

* Note: If you've made customizations to the files in the "etc" directory in either the install or work directories be sure to check and see if any absolute paths have been used.  These may need to be adjusted in the new installation.

Have more questions? Submit a request


Article is closed for comments.