Can I pre-cache artifacts in Nexus Repository 2 proxy storage using rsync while Nexus Repository 2 is running?

Visit for documentation on Nexus Repository version 2.

You may wonder if manually copying or rsyncing artifacts to Nexus Repository proxy repository storage while Nexus Repository is running will help improve performance serving these artifacts. The short answer is:


This isn't a good idea.

By doing this you will bypass the internal file locking in Nexus Repository 2. This means that it is possible a request coming into the server will receive a partial file.

Also, there are directories at sonatype-work/nexus/storage/<repository>/.nexus and sonatype-work/nexus/storage/<repository>/.meta which store meta information about files in storage and the repository itself. This meta information is not the same on the proxy side as it is on the remote, so you could effectively put the proxy repository in an inconsistent state by using rsync. Also, if one of these files is in a partially written state when Nexus attempts to read it it could result in a download failure of the corresponding artifacts.

Search indexes would also not be updated in real time, unlike when an artifact was cached by nexus itself.

Instead, we recommend using Nexus Repository 2 Pro's Smart Proxy with preemptive fetch enabled. If this is not working let us know and we will help diagnose the problem.

Have more questions? Submit a request


Article is closed for comments.