[Mediawiki-l] HOWTO set up an emergency mirror copy of your intranet wiki

David Gerard dgerard at gmail.com
Wed Jun 8 09:49:51 UTC 2011


This is all the obvious method, but the key thing I want to note is
that it actually works smoothly just as you would expect :-)


Our intranet wiki is MediaWiki 1.13 using MySQL on a Solaris 10 box,
which is our general internal-use database server. Oracle runs on the
same box and decided to fill /data last week, breaking MySQL and hence
the wiki we use for the instructions on how to fix the box ...

So I set up something to mirror it.

1. Install 1.17b1 on a RHEL 5 VM (that we already have a copy of
MediaWiki 1.15 on). Defaults are fine.
2. Put this script in the maintenance directory of the first box
(server names anonymised), using your full paths to php and scp, run
it from cron at 5am every day:

 #!/usr/bin/bash
 cd /data/apache/mediawiki-1.13.3/maintenance
 /usr/local/bin/php dumpBackup.php --full >dump.xml
 /usr/bin/scp dump.xml
admin at box2.internal.example.com:/usr/local/apache2/htdocs/techwiki/maintenance

3. Put the ssh key for the first box user the script runs as in
~admin/.ssh/authorized_keys on the second box, so the scp runs
unattended.
4. Put this script in the maintenance directory of the second box,
using your full path to php, run it from cron at 6am every day:

 #!/bin/bash
 cd /usr/local/apache2/htdocs/techwiki/maintenance
 /usr/bin/php importDump.php dump.xml
 /usr/bin/php rebuildrecentchanges.php

This doesn't copy images or files - we don't use images much at all.
That can come later if we care :-) Looking a bit broken may well be a
feature in this context ...

I put a notice in MediaWiki:Sitenotice and MediaWiki:Anonnotice on the
mirror copy that this was a read-only mirror, and disabled editing for
everyone who wasn't me.


(and yes, I have vague plans to update the wiki from 1.13. OTOH,
MediaWiki on Solaris is so stupidly painful in my experience that I
advise no-one do it ever.)


- d.



More information about the MediaWiki-l mailing list