Skip to content

Instant update mirroring

ranguard edited this page Jul 7, 2012 · 17 revisions

Instant Update Mirroring

CPAN mirroring uses File::Rsync::Mirror::Recent (also known as rrr, version 0.1.1 or later required). It is also available from git.

You can use this for the full CPAN; no need to separately use rrr for the PAUSE directories.

How to install

curl --compressed -LO http://xrl.us/cpanm
chmod +x ./cpanm
./cpanm JSON File::Rsync::Mirror::Recent

Also check that you have rsync installed; version 3.x or newer is highly recommended.

Run the client

Use rrr-client:

   mkdir -p /home/mirrors/CPAN
   rrr-client --source cpan-rsync.perl.org::CPAN/RECENT.recent --target /home/mirrors/CPAN

Client resources

It will take a while - up to several hours - to get synced up. During this time the system may use a good deal of CPU and momentarily up to 1GB of memory. After that it'll get the latest changes every 20 seconds with virtually no CPU usage and just using about 10MB of memory -- basically less resources than running rsync just a few times a day. And you get instant updates!

What to test

If you want to test if all updates from the master have been fetched, you can run

   rsync -avn cpan-rsync.perl.org::CPAN /home/mirrors/CPAN

There should only be a few changes - files that have changed in the last minute. If there are more, run rsync again without the -n parameter to update your mirror. Please report any discrepancies!

In production is recommended to run a full rsync every few days in case rrr missed something.

rsync masters

  • Public, no authentication required: cpan-rsync.perl.org
  • For "Tier 1" mirrors, cpan-rsync-master.perl.org (the "master mirror")

The plan is to make cpan-rsync.perl.org point to a group of instantly updated mirrors -- the "Tier 1" mirrors. With some clever DNS, we can even have clients of the tier 1 mirrors pull appropriately from a mirror in their country or on their continent.

If you wish to be a tier 1 mirror, please email [email protected] for a username/password for the master mirror for testing.