• Hi there,

    I’m try to setup db partitioning for multisite with 15 child sites. Currently I’m config as Sample Configuration and it work. All child site tables are stored on blogdb.

    ### Sample Configuration

    
    $wpdb->add_database( array(
    	'host'     => 'global.db.example.com',
    	'user'     => 'globaluser',
    	'password' => 'globalpassword',
    	'name'     => 'globaldb',
    ) );
    
    $wpdb->add_database( array(
    	'host'     => 'blog.db.example.com',
    	'user'     => 'bloguser',
    	'password' => 'blogpassword',
    	'name'     => 'blogdb',
    	'dataset'  => 'blog',
    ) );
    
    $wpdb->add_callback( 'my_db_callback' );
    
    // Multisite blog tables are "{$base_prefix}{$blog_id}_*"
    function my_db_callback( $query, $wpdb ) {
    	if ( preg_match("/^{$wpdb->base_prefix}\d+_/i", $wpdb->table) ) {
    		return 'blog';
    	}
    }
    

    Now I want config 5 child sites on a db. Eg,
    – Site id 2-5 stored on db name call child_db_2_5
    – Site id 6-10 stored on db name call child_db_6_10
    – Site id 11-15 stored on db name call child_db_11_15

    How can I do that?

    Thanks for your help,
    Regards,

    • This topic was modified 6 years, 1 month ago by Le Duy Quang.
  • The topic ‘Need help with Partitioning config’ is closed to new replies.