• Jackpotgee

    (@jackpotgee)


    I am trying to partition our database across 4 separate servers.

    When testing on our development site I had the tables split into four databases but on the same server. This worked.

    However, when it came to splitting the databases across different servers the site crashed.

    I’ve tried a number of different configs. Including:

    $wpdb->add_database(array(
    	'host'     => 'xxx1',     // If port is other than 3306, use host:port.
    	'user'     => DB_USER,
    	'password' => DB_PASSWORD,
    	'name'     => 'db1name',
    ));
    
    $wpdb->add_database(array(
    	'host'     => 'xxx2',     // If port is other than 3306, use host:port.
    	'user'     => DB_USER2,
    	'password' => DB_PASSWORD2,
    	'name'     => 'db2name',
    	'write'    => 1,
    	'read'     => 1,
    	'dataset'  => 'news',
    	'timeout'  => 0.2,
    ));
    
    $wpdb->add_table( 'news', 'tablename' );

    I have also tried using :

    $wpdb->add_callback('my_db_callback');
    function my_db_callback($query, $wpdb) {
    	// Multisite blog tables are "{$base_prefix}{$blog_id}_*"
    	if ( preg_match("/tablename/", $wpdb->table) )
    		return 'news';

    Can anyone tell me what i’m missing? we ideally want to split the tables over several servers but currently i have settled for a master/slave environment.

    Any help would be grand…

    https://www.ads-software.com/extend/plugins/hyperdb/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Partitioning database across different servers’ is closed to new replies.