* Wrote two concrete implementations. LBFactory_Simple is for general installations. LBFactory_Multi will replace the runtime configuration used on Wikimedia and allow load-balanced connections to any DB. * Ported Special:Userrights, CentralAuth and OAI audit to the LBFactory system. * Added ForeignDBViaLBRepo, a file repository which uses LBFactory. * Removed $wgLoadBalancer and $wgAlternateMaster * Improved the query group concept to allow failover and lag control * Improved getReaderIndex(), it will now try all servers before waiting, instead of waiting after each. * Removed the $fail parameter to getConnection(), obsolete. * Removed the useless force() function. * Abstracted the replication position interface to allow for future non-MySQL support. * Rearranged Database.php. Added a few debugging features. * Removed ancient benet-specific hack from waitForSlave.php
25 lines
600 B
PHP
25 lines
600 B
PHP
<?php
|
|
|
|
require 'commandLine.inc';
|
|
|
|
$lb = wfGetLB();
|
|
|
|
if( $lb->getServerCount() == 1 ) {
|
|
echo "This script dumps replication lag times, but you don't seem to have\n";
|
|
echo "a multi-host db server configuration.\n";
|
|
} else {
|
|
$lags = $lb->getLagTimes();
|
|
foreach( $lags as $n => $lag ) {
|
|
$host = $lb->getServerName( $n );
|
|
if( IP::isValid( $host ) ) {
|
|
$ip = $host;
|
|
$host = gethostbyaddr( $host );
|
|
} else {
|
|
$ip = gethostbyname( $host );
|
|
}
|
|
$starLen = min( intval( $lag ), 40 );
|
|
$stars = str_repeat( '*', $starLen );
|
|
printf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars );
|
|
}
|
|
}
|
|
|