rsync has a way of doing disconnected copies. In other words, rsync can (conceptually) diff a directory tree and produce a patch file which you then later can apply on any number of files that are identical to the original source.
It requires that you invoke rsync with the master and mirror with --write-batch
; it produces a file. You then transfer this file to any number of other targets, and you then apply the batch to each of those targets using --read-batch
.
If you keep a local copy of the last rsynced state (i.e. a copy of what the mirrors look like right now) on the same machine as the master, you can generate this "patch" on the master without even contacting any mirror:
On the master:
rsync --write-batch=my-batch.rsync /master/data /current/mirror
Add whatever other options you want. This will do two things:
- It will make
/current/mirror
change to reflect /master/data
- It will create a binary patch file (or batch file) called
my-batch.rsync
for later use.
Transfer the my-batch.rsync
file from the master to all of your mirrors, and then on the mirrors, apply the patch so to speak:
rsync --read-batch=my-batch.rsync /local/mirror
Benefits of this approach:
- master is not swamped
- no need to coordinate/have access to the master / mirror(s) at the same time
- different people with different privileges can do the work on the master and mirror(s).
- no need to have a TCP channel (ssh, netcat, whatever; the file can be sent via e-mail ;-) )
- offline mirrors can be synced later (just bring them on-line and apply the patch)
- all mirrors guaranteed to be identical (since they apply the same "patch")
- all mirrors can be updated simultaneously (since the
--read-batch
is only cpu/io intensive on the mirror itself)