[Mediawiki-l] Sending DB reads to master if slave replication fails?

Jani Patokallio jpatokal at iki.fi
Thu Apr 7 00:40:46 UTC 2011


So I've got a small wiki cluster which doesn't have particularly high
load, but where reliability is important.  There is one MySQL DB
master (load 0 = write only) and one slave (load 1 = read only).

By default, if MySQL's replication fails, MediaWiki doesn't seem to
notice and users get confused since their writes go to master and are
not reflected in what they read from the slave.  However, the
$wgDBservers help page says that there is a "max lag" parameter,
defined as "Maximum replication lag before a slave will be taken out
of rotation".  Assume I use it like this:

$wgDBservers = array(
                 'host' => "master.serv.er",
                 'load' => 0,
                 'host' => "slave1.serv.er",
                 'load' => 1,
                 'max lag' => 30

If slave now fails, does this mean that a) both reads and writes are
sent to master, or that b) MediaWiki switches into read-only mode
since there are no slaves left to handle writes?  If the answer is
"b", is there any way I can make scenario "a" happen?


More information about the MediaWiki-l mailing list