MyBB Community Forums

Full Version: Multiple databases?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was trying to use the information providere here to setup 2 database servers (both read and write) but I cannot get it to work. It looks like it mixes and matches the information (error connecting userA to serverB, userA to serverB without a password, userB to serverA, etc...). Any assistance would be great. Big Grin
Ok, I got it to work... sorta. It will read and write from both servers but it will not write to both databases at the same time like it said on that page. Is this no longer supported?

$config['database']['type'] = 'mysql';
$config['database']['database'] = 'database';
$config['database']['table_prefix'] = 'mybb_';
$config['database']['read'][0]['hostname'] = 'localhost';
$config['database']['read'][0]['username'] = 'username';
$config['database']['read'][0]['password'] = 'password';

$config['database']['type'] = 'mysql';
$config['database']['database'] = 'database';
$config['database']['table_prefix'] = 'mybb_';
$config['database']['read'][1]['hostname'] = '111.111.111.111';
$config['database']['read'][1]['username'] = 'username';
$config['database']['read'][1]['password'] = 'password';

$config['database']['type'] = 'mysql';
$config['database']['database'] = 'database';
$config['database']['table_prefix'] = 'mybb_';
$config['database']['write'][0]['hostname'] = 'localhost';
$config['database']['write'][0]['username'] = 'username';
$config['database']['write'][0]['password'] = 'password';

$config['database']['type'] = 'mysql';
$config['database']['database'] = 'database';
$config['database']['table_prefix'] = 'mybb_';
$config['database']['write'][1]['hostname'] = '111.111.111.111';
$config['database']['write'][1]['username'] = 'username';
$config['database']['write'][1]['password'] = 'password';
After looking at the code in db_mysql.php I'm still lost. Sad
Bueller? Bueller?
It looks like it's actually a typo on that page.

MyBB will only connect to ONE read server, and ONE write server per page load to do all of its work. This is functionality designed for large forums, where the database needs to be scaled beyond one database.

Behind the scenes, you should setup replication in whichever DBMS you're using. (MySQL http://dev.mysql.com/doc/refman/5.0/en/replication.html)

In terms of database server configuration, you setup your write servers as your masters, and your read-only servers as your slaves. In the case of multiple write servers, then what you're after is called a multi-master setup.

Note, another way to do this outside of MyBB with MySQL would be using something like MySQL Proxy - http://forge.mysql.com/wiki/MySQL_Proxy
(2010-12-05, 12:10 PM)Chris Boulton Wrote: [ -> ]MyBB will only connect to ONE read server, and ONE write server per page load to do all of its work. This is functionality designed for large forums, where the database needs to be scaled beyond one database.

What do you mean one read, one write per page load? So what said here is totally, still, wrong?

I've done enough MySQL replications personally. My question to your implementation is this... for any reason if one of the master write node was unavailable due to system/network interruption, what happens? Does MyBB keep a log for that particular write node and will resume where it left off when it comes online? Or that segment of data is lost?