Migrate Sonatype Nexus repo from one machine to another
I am trying to migrate nexus repo. How can I go about it, any pointers?
Solution 1:
As stated in the doco the data storage and config. is separated from the application.
This way you can just copy both the application directory (Something like /opt/nexus-oss-webapp-X.Y.Z/
) and your data directory (/opt/sonatype-work/
) to a new server without any trouble.
I suspect the only setting that you'll need to change before trying to restart it is the repository URL which can be done by editing sonatype-work/nexus/conf/nexus.xml
.
I just moved my repo from a machine to another, and upgraded it from 1.8.x to 1.9.0 at the same time without any trouble.
Solution 2:
For the most recent version of Nexus which creates a structure similar to this:
blobs cache db elasticsearch etc generated-bundles instances javaprefs kar keystores lock log orient port restore-from-backup tmp
You can simply zip up both the blobs and the db directory and replace them from a fresh install of Nexus at the new location.
Don't forget to chown the files after unzipping to the appropriate permissions.
Make sure Nexus is stopped before you replace them. Once replaced, start Nexus back up it should start with no problems and start re-indexing.
Solution 3:
One could use N3DR for migrating maven artifacts from an old to a new Nexus repository. Perhaps this section could be helpful:
"Clone" a Nexus3 repository
Suppose that one has created a new Nexus3 repository, e.g. NexusNEW and that one would like to copy the content of the old repository, e.g. NexusOLD, then these basic steps could be issued to "clone" NexusOLD:
n3dr backup -u -n \ -r cd download mv n3dr upload -u -n \ -r