MyBB Community Forums

Full Version: how to config Mybb database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi~ I have a mysql master/slave clusters。How to config it will goes well on Mybb?
Like this:
mysql master: host1:port1
mysql slave: host2:prot2
(2012-09-11, 05:33 AM)Nathan Malcolm Wrote: [ -> ]Please see: http://docs.mybb.com/Performance.html
thanks very much,This is the answer I'm looking for.Big GrinBig GrinBig Grin

(2012-09-11, 05:33 AM)Nathan Malcolm Wrote: [ -> ]Please see: http://docs.mybb.com/Performance.html

I found the below code seems a bug:
/**
 *$config['type'] = 'mysqli';
 *$config['read']['database'] = 'mybb';
 *$config['read']['table_prefix'] = 'mybb_';
 *$config['read']['hostname'] = 'localhost_read_address';
 *$config['read']['username'] = 'root';
 *$config['read']['password'] = '******';

 *$config['write']['database'] = 'mybb';
 *$config['write']['table_prefix'] = 'mybb_';
 *$config['write']['hostname'] = 'localhost_write_address';
 *$config['write']['username'] = 'root';
 *$config['write']['password'] = '******';
 */
function connect($config)
{
    if(array_key_exists('hostname', $config))
    {
	$connections['read'][] = $config;
    }
    else
    {
	if(!array_key_exists('read', $config))
	{
		foreach($config as $key => $settings)
		{
			if(is_int($key)) $connections['read'][] = $settings;
		}
	}
	else
	{
		$connections = $config;
	}
    }
    $this->db_encoding = $config['encoding'];
    foreach(array('read', 'write') as $type)
    {
        //$connections[$type] is also an array
         if(!is_array($connections[$type])) 
	 {
		break;
	 }
    }
    ......
}