How do I replicate remote repository cache in one Artifactory to another Artifactory?

JFrog Support
2017-02-06 13:39

You may use one of the two methods below to setup a replication from remote cache of an Artifactory (source) to another artifactory (destination).


<METHOD 1: Using Pull Replication>

In the destination Artifactory, setup a remote repository that points to the source Artifactory. Afterward, setup replication using Cron job. Event based replication is not available for this pull replication. For more information, visit this link.


<METHOD 2: Using Push&Event Replication with User Plugin>

Alternately, you may create a User plugin, so cached artifact gets copied to a local repository, which supports event-based-push-replication.  Use steps below as an example:


In your source Artifactory, 


1. Create a local repository and enable push replication to your destination Artifactory repository


2. Locate the remote repository that you would like to replicate from. The repository name will have "-cache" appended to your remote repository


3. Make a copy of this groovy file and the properties file at $CLUSTER_HOME/ha-etc/plugins/ (if you are using a single node, then the location is $ARTIFACTORY_HOME/etc/plugins). Ensure to modify the properties file to match the local repository and the remote cache repository (e.g. xxx-cache)


4. Afterward, apply the changes by running this REST API to each Artifactory node.


5. In the source Artifactory, manually copy all cache files from the remote-cache repository to the local repository. Observe that the replications get triggered and files get copied to the destination.


6. Newly cached files do not need to get manually copied over to the local repository, since the user plugin will make copy. Note that Artifactory does not store binaries more than once within the same Artifactory instance; thus the copy operation simply creates a reference to the new location.