skip to content

Two Artifactory sites push-replicate the same local repositories to each other, and disk use keeps climbing at both; what is wrong, and how should cross-site sync work instead?

level: seniorimportance: should knowfreq 38%

answer

  1. who replicates to whom
  2. a loop between servers
  3. one direction per repository
  4. push to one, pull to many
  5. federation for multi-site

basics

~20 s

This is cyclic replication, which Artifactory warns can lose data or grow disk use exponentially. Give each repository one direction: push from the owning site, pull to many sites, or use Federated repositories built for multi-site synchronisation.

solid answer

~50 s

Each site pushes the same repositories to the other, so each replication acts on the other's output: Artifactory's documentation calls this **cyclic** or bi-directional replication and warns it can cause loss of data or exponential growth of disk use. Fix the topology, not the disks. Give every repository **one source**: push replication from the site that owns it, or **pull replication** where many sites fetch from one source, which is one-to-many and keeps each package to a single hop. Where one repository must stay in step across several sites, use **Federated repositories**, whose members synchronise their contents with each other. Then tune the mechanics: event-based push for near-real-time updates with a scheduled run behind it as a consistency backstop, a dedicated service user's credentials on each link, and the same Artifactory version on both ends. Treat **Sync Deleted Artifacts** with care: with an empty source it purges the target.

go deeper

for a junior

Know what replication is for: the same artifacts available at every site, without every build crossing a slow link. Push sends from the source; pull fetches at the target.

for a middle

Explain push vs pull, event-based vs scheduled, and why the scheduled run backs up the events. Mention that push replicates local repositories and pull is set on a remote repository.

for a senior

Spot the cyclic loop and redesign it: one owner per repository, pull for one-to-many, federation for repositories shared by several sites, careful use of delete sync, credentials and version alignment on every link.

for a principal

Decide what multi-site means for the organisation: which repositories truly need every site to write, what latency is acceptable, and whether federation's global deletes fit the retention and audit rules you commit to.

## What replication is for **Repository replication** keeps copies of a repository in step across repository-manager instances, usually at different geographic sites. Artifactory's documentation lists the reasons: everyone works with the same versions of remote artifacts, build artifacts are shared efficiently between distant teams, and network latency or instability between sites stops hurting builds. Replication is different from a proxy. A proxy fetches a file on demand when a client asks for it. Replication copies content ahead of time, on a schedule or on every change, so the far site already has it. ## Why the scenario goes wrong When site A pushes repository `libs-release` to site B and site B pushes the same repository back to site A, every change travels in a loop. Artifactory's documentation names this **cyclic replication** (also "bi-directional") and covers longer rings too: A to B, B to C, C back to A. Its warning is direct: avoid it, because it can cause **loss of data** or **exponential growth of disk-space usage**. Each side keeps applying the other side's replication output to its own copy, so neither copy has a single source of truth. Adding disk treats the symptom; the topology is the defect. ## The replication modes | Mode | Who acts | What it syncs | When it fits | |---|---|---|---| | Push (scheduled) | the source pushes on a cron schedule | a full sync of the local repository | baseline consistency | | Push (event-based) | the source pushes on each create, copy, move or delete | only the artifacts in that event | near-real-time updates | | Pull (scheduled) | a remote repository at the target pulls | local, remote or virtual repositories at the source | proactively warming a remote cache | | Pull (event-based) | the target receives events over a channel | changes as they happen | Enterprise licence required | Some facts from the documentation that interviewers probe: - **Push replicates local repositories**; pull replication is configured on a **remote repository** at the receiving site. - **Event-based and scheduled push work together.** An event replicates only what that event changed; the scheduled run syncs the whole repository, so a failed event is caught on the next scheduled run. - **Multi-push** (one source to many targets) needs an Enterprise licence; without one you may define a single push target per repository. - **Pull is one-to-many and one hop.** Many targets can pull from the same source, and each package travels only one hop, which the documentation calls safer. - **Pull only works between Artifactory repositories.** Third-party registries are cached on demand through an ordinary remote repository instead. - **Replication is for ongoing synchronisation**, not very large one-time migrations, and include/exclude patterns should stay concise. ## A topology that holds 1. **One owner per repository.** Each repository is written at one site. That site pushes it (event-based plus scheduled) to the others, or the others pull it. 2. **Receive into separate repositories where both sites publish.** If both sites produce releases, give each site its own local repository and replicate each one outward; a group or virtual repository at each site then combines the local copy and the replicated one. 3. **Use Federated repositories for multi-site sync.** Federated repositories synchronise their contents with the other members of the same Federation, the mechanism Artifactory offers for keeping one repository in step across sites. The documentation's own example: a retention policy's deletions on one member propagate to every member, so a deletion is a global act. 4. **Service-user credentials on every link.** Event-based pull now rejects anonymous callers on its channel endpoints, so the pulling side needs a username and password or identity token of a user with read access at the source. 5. **Keep versions aligned.** Artifactory says to replicate between servers on the same version; upgrade the other side soon after one is upgraded. ## The delete switch **Sync Deleted Artifacts** on a push target means items deleted at the source are also deleted at the target. The documentation's warning is literal: if the source repository is empty, replication purges the target. A mistaken bulk delete, or pointing replication at a freshly created empty repository, can empty a production mirror. Enable it only where the target must be an exact copy, and keep backups of the target. ## The same ideas in Harbor Harbor replicates images and charts with **push-based** or **pull-based** rules to and from Harbor and non-Harbor registries. Manual and scheduled triggers do not replicate deletions; an event-based rule replicates pushes and retags at once, and deletes only if **Delete remote resources when locally deleted** is selected. A failed task is retried several times, and replication between different Harbor versions is not supported. The same one-direction discipline applies: two rules pushing the same project at each other recreate the loop.

  • Developers at the far site cannot find a release published an hour ago, though event-based push replication is on. What do you check?
    Whether the event replication for that artifact failed: replication messages are in the Artifactory service log, and the repository's Replication tab shows the targets. An event syncs only its own artifacts, so a failure is repaired only by the next scheduled full sync. Check the cron expression exists and runs, the target URL and credentials, and the network between sites, then trigger replication manually from the repository's Replications tab if needed.
  • When is pull replication a better fit than push?
    When one repository must reach many sites, because many targets can pull from one source and each package makes a single hop. It also fits when the source sits behind a proxy that prevents push replication, such as a SaaS-hosted instance replicating to a local repository at your own site. It is configured on a remote repository at the receiving site and only works against another Artifactory repository.

  • Replicating both ways between two sites keeps them perfectly in sync.
  • Event-based push alone is enough; the scheduled run is redundant.
  • Sync Deleted Artifacts is safe to enable on every replication target.
  • Pull replication can mirror any public registry, not just Artifactory.
  • A retention run on one Federated member deletes only that member's copies.