Manual talk:$wgLBFactoryConf

Latest comment: 6 years ago by Bawolff

In case its helpful to anyone, I recently needed to test GlobalUsage on my local test install, which needed this var set up.


Here's what I used to set up a no-frill "wikifarm" of 3 mediawiki installs. All in different db's (although if using db prefixes, wouldn't be too different, I think you just use a dash in the db name), all the db's in the same server, and only master db's (no slaves). I mostly just edited things until it worked, so not 100% sure if proper way. Anyways, perhaps this would be helpful to someone:

// This is in LocalSettings.php for all 3 wikis.
// $wgDBname must be set earlier as appropriate. ($wgDBname = 'wikidb1';)
$wgDBuser = 'your db username'; //must be same for all 3 wikis in this simplified setup
$wgDBpassword = 'pass'; // Same pass must be usable for all 3 wikis
$wgLBFactoryConf = array(

'class' => 'LBFactory_Multi',

'sectionsByDB' => array(
    'wikidb1' => 's1', // Assumes db name for first wiki is wikidb1
    'wikidb2' => 's1', // and so on.
    'wikidb3' => 's1',
),

'sectionLoads' => array(
    's1' => array(
        'localhost'  => 0, // All on section s1, which has single master, at localhost.
    ),
),


'serverTemplate' => array(
    'dbname'      => $wgDBname,
    'user'          => $wgDBuser,
    'password'      => $wgDBpassword,
    'type'          => 'mysql',
    'flags'          => DBO_DEFAULT,
    'max lag'      => 30,
),
);

Bawolff 10:20, 3 January 2012 (UTC)Reply

Hi @Bawolff , I tried your settings, which work fine. Then I tried to set wgForeignFileRepos with the 'class' => 'ForeignDBViaLBRepo'. This settings should get Server info from $wgLBFactoryConf. But it actually return me an error: "InvalidArgumentException from line 371 of /includes/libs/rdbms/loadbalancer/LoadBalancer.php: Empty server array given to LoadBalancer". What's wrong? --Zoglun (talk) 04:15, 24 December 2017 (UTC)Reply
Just to close the loop, according to phab:T183653 that error was due to something unrelated right? (p.s. use {{ping|<username>}} to ping people, like @Zoglun: otherwise i don't get notices). Bawolff (talk) 18:43, 26 December 2017 (UTC)Reply
Return to "$wgLBFactoryConf" page.