[Mediawiki-l] building a replica/backup media wiki

Joseph Spenner joseph85750 at yahoo.com
Wed Mar 14 22:51:06 UTC 2012


I'm currently trying to run a nightly backup/copy of my production media wiki to a "read only" copy on another system.  I wrote a script to do everything through ssh:

----

#!/usr/bin/ksh

scripts=/scripts

mysqldump --opt wikidb -u root -psomePass > $scripts/wikidb.sql

scp $scripts/wikidb.sql 10.4.3.1:tmp || exit

sleep 3

ssh 10.4.3.1 '/usr/bin/mysql -u root -psomePass wikidb < tmp/wikidb.sql' || exit

echo replica wiki database updated

echo syncing attachments and files

rsync --delete -avz -e ssh /var/www/htdocs/wiki/images root at 10.4.3.1:/var/www/htdocs/wiki

----

My copy/replica has an entry in the LocalSettings.php to make it a read-only wiki:

$wgReadOnly = 'Read Only';

It works great.

However, when I access the replica after a period of time, it's VERY slow/sluggish.  If I edit the LocalSettings.php file and disable the 'read only' line, it's lightning fast again.  If I then change it back to 'read only', it's still fast but slows down over the course of the night.

The only way around this was to make a little script which places a normal edit-able LocalSettings.php file into place, then does a wget to one of the wiki pages, then copies the 'read only' version of the LocalSettings.php file back into place.  After I run the script, it's fast again.

Anyone know why this slowness occurs?  I've tested the mysql response time via command line while the wiki is slow, and the mysql is still fast.  It's some interaction between apache and mysql which causes this replica to slow down.  If I try to access a 'non wiki' document (ie: some file on the webserver) it does not have any latency.

Any ideas/help would be great.

Thanks!


More information about the MediaWiki-l mailing list