Skip to end of metadata
Go to start of metadata

Overview

Through the Replication Add-on in Artifactory Pro, Artifactory allows replication of repositories to support development by different teams distributed over distant geographical sites. The benefits of replication are:

  • Ensuring developers all work with the same version of remote artifacts
  • Ensuring build artifacts are shared efficiently between the different development teams
  • Overcome connectivity issues such as network latency and stability when accessing remote artifacts
  • Accessing specific versions of remote artifacts

Artifactory versions for replication

We strongly recommend that replication is only performed between servers running the same version of Artifactory Pro.

Two main methods of replication are supported:

Push Replication

Push replication is used to synchronize局部存储库, and is implemented by the Artifactory server on the near end invoking a synchronization of artifacts to the far end.

There are two ways to invoke push replication:

  • Scheduled push: Pushes are scheduled asynchronously at regular intervals
  • Event-based push:Pushes occur in nearly in real-time since each create, copy, move or delete of an artifact is immediately propagated to the far end.

Advantages

  • It is fast because it is asynchronous.
  • It minimizes the time that repositories are not synchronized.
  • It reduces traffic on the master node in case of a replication chain ("Server A" replicates to "Server B", "Server B" then replicates to "Server C" etc.).

Avoid Replication Loops ("Cyclic Replication")

A replication loop occurs ("Cyclic" or "Bi-directional" replication) occurs when two instances of Artifactory running on different servers are replicating content from one to the other concurrently.

For example, "Server A" is configured to replicate its repositories to "Server B", while at the same time, "Server B" is configured to replicate its repositories to "Server A".

Or "Server A" replicates to "Server B" which replicates to "Server C" which replicates back to "Server A".

We strongly recommend avoiding cyclic replication since this can have disastrous effects on your system causing loss of data, or conversely, exponential growth of disk-space usage.

Replication loop to be strictly avoided

When to Use Push Replication

Event-based push replication is recommended when it is important for the repository at the far end to be updated in near-real-time for any change (create, copy, move or delete of an artifact) in the repository at the near end.

In addition, we recommend running regular scheduled replication on top of event-based replication to guarantee full copy consistency even in cases of server downtime and network partitions.

Multi-push Replication

With an Enterprise license, Artifactory supports multi-push replication allowing you to replicate a local repository from a single source to multiple enterprise target sites simultaneously.

Pull Replication

Pull replication is invoked by a remote repository, and runs according to a defined schedule to synchronize repositories (local, remote or virtual) at regular intervals.

This provides a convenient way to proactively populate a remote cache, and is very useful when waiting for new artifacts to arrive on demand (when first requested) is not desirable due to network latency.

Pull replication runs as a scheduled task.

Advantages

  • Many target servers can pull from the same source server efficiently implementing a one-to-many replication.
  • It is safer since each package only has one "hop".
  • It reduces traffic on target servers since they do not have to pass on artifacts in a replication chain.

When to Use Pull Replication

Pull replication is recommended in the following cases:

  • When you need to replicate a repository to many targets pull replication.
  • When your source repository is located behind a proxy that prevents push replication (e.g. replicating a repository hosted on Artifactory online to a local repository at your site)

Page Contents


Scheduling and Configuring Replication

Using the UI

Replication is configured via the user interface as a scheduled task. Local repositories can be configured for push replication, and remote repositories can be configured for pull replication.

All replication messages are logged in the mainArtifactory log file(artifactory.log).

Configuring Push Replication

A push replication task for a Local Repository is configured in theReplicationtab of theEdit Local Repositorydialog.

First, in theCron Expressionfield define the replication task schedule using avalidcronexpression.

TheNext Replication Timewill indicate update accordingly.

The repository is replicated to all targets using the same schedule

Replication of this repository to all of its targets occurs simultaneously according to theCron Expressionyou define.

To add a target site for this replication, clickAddto display theReplication Propertiesdialog, and fill in the details as follows.

Field Name Description

URL

The URL of the target local repository on a remote Artifactory server.

Username

The HTTP authentication username.

Password

The HTTP authentication password.

Proxy

A proxy configuration to use when communicating with the remote instance.

Socket Timeout

The network timeout in milliseconds to use for remote operations.

Sync Deletes

当设置,远程删除该项目also be deleted locally (also applies to properties metadata).

Sync Properties

When set, the task also synchronizes the properties of replicated artifacts.

Path Prefix(optional)

库中的复制的子路径。


Once you have configured the replication properties for each of your replication targets, theReplicationtab for your repository displays them.

Field Name Description

Push to

The replication targets you have defined

Enabled

When set, enables replication of this repository to the target specified inPush to

Enable Event Replication

When set, event-based push replication is enabled

Number of replication targets

If you do not have an Enterprise license, you may only defineonereplication target. With an Enterprise license, Artifactory supports multi-push replication and you may define as many targets as you need.

Configuring Pull Replication

Configuring Pull Replication for aRemote Repositoryis very similar to configuring Push Replication for a Local Repository. Please refer toConfiguring Push Replicationfor details.

Regarding credentials of the remote repository configuration

The remote repository's file listing for replication is retrieved using the repository's credentials defined under the repository'sAdvancedconfiguration section.

The remote files retrieved depend on the effective permissions of the configured user on the remote repository (on the other Artifactory instance).

Replicating with REST API

Both Push and Pull Replication are supported by Artifactory's REST API. For details please refer to the following:

Replication Properties

Once replication has been invoked, Artifactory annotates the source repository being replicated and annotates it with properties that indicate the status of the replication. These can be viewed, along with other properties that may annotate the repository, in thePropertiestab of theTree Browser.

For single push replication operations, the following properties are created/updated:

Key Value
artifactory.replication..started Indicates when the replication started
artifactory.replication.<source_repo_key>.status

Indicates the status of the replication operation once complete. It can take the following values:

ok: The replication succeeded

failure: The replication failed. You should check the log files for errors

artifactory.replication.<source_repo_key>.finished Indicates when the replication finished

For multi-push replication operations (available to Enterprise customers only), the following properties are created/updated:

Key Value
artifactory.replication._.started Indicates when the replication started
artifactory.replication._.status

Indicates the status of the replication operation once complete. It can take the following values:

ok: The replication succeeded

failure: The replication failed. You should check the log files for errors

artifactory.replication._.finished Indicates when the replication finished


Watch the Screencast

To see the Replication in action you can watch the short demo screencast below.