Moving a Nexus Repo 3 Instance to a New Location


To move a Nexus Repo 3 server to a new location you'll need to move three main things after Nexus Repository is gracefully stopped:

  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

DO NOT move the following directories within the $data-dir:

  • cache - temporary files instance specific
  • tmp - temporary files are instance specific

Cautiously move these directories within the $data-dir:

  • elasticsearch

If your last shutdown of the source was not graceful ( abrupt termination ), or in cases files are copied while source NXRM is running, then starting the new target instance with these files present may

  • result in corruption of the Search and Browse views, and certain REST API results in the target instance
  • prevent startup of the target instance

If startup fails or corruption occurs in the target instance due to elasticsearch errors, simply delete the elasticsearch directory in the target and when the target instance restarts, elasticsearch indexes will automatically rebuild.

Optionally move these from $data-dir:

  • logs - logs could be kept instance specific, or if you want to preserve the long term history of a moved instance, include moving these files to the new host

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.

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:

Best Practice

Embedded OrientDB Files

OrientDB files are located under the $data-dir/db directory. Please ensure this advice is followed to avoid embedded OrientDB corruption:

  1. Embedded OrientDB database files must be copied when Nexus Repository is not running
  2. The target location of embedded OrientDB database files must ALWAYS be empty and not contain ANY files from previous copies

Do not use the built in Admin - Export databases for backup task to move a database copy from one instance to another. That is not the purpose of that task. That task should only be used to create backups that could be restored into the exact same instance/location from which they were created.

File Based Blobstores

When using a backup tool that can perform incremental backups, an initial copy of the blobstore contents can be done while the original Nexus Repo 3 is still running. 

If you're using rsync, this can be done using this general process:

  1. Perform an initial sync of File based blobstore data
    rsync -avP <source> <dest>
  2. Shut down Nexus Repository 3
  3. Perform a second copy operation to capture any delta from the first copy:
    rsync -avP --del <source> <dest>

    The --del option ensures the target does not contain any files not present in the source.

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.

Moving Large Amounts of Data to Cloud Storage

The best performance moving terrabytes(TB) of blobstore data to the cloud requires using cloud native tooling. The built in product features like Repository Export/Import tasks, Change repository blob store task, and Blobstore groups are not intended for moving TB of data more efficiently than native tooling. Please refer to your cloud storage native options:

Amazon Web Services:

File Customizations Containing Absolute File Paths

If you've made customizations to the files in the "etc" directory in either the install or data directories, then be sure to check and see if any absolute paths have been used. These may need to be adjusted in the new instance location.

Have more questions? Submit a request


Article is closed for comments.