WordPress.org

Ready to get started?Download WordPress

Forums

HyperDB
Partitioning database across different servers (2 posts)

  1. Jackpotgee
    Member
    Posted 1 year ago #

    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...

    http://wordpress.org/extend/plugins/hyperdb/

  2. Alexandru Vornicescu
    Member
    Posted 1 year ago #

    maybe increase the timeout

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic