Hi,
I’m not surprised not getting any information on this topic, but it’s worth at least trying ??
To keep this threat up, I’ve found a little piece of cake on one of the possibilities of configuration of Hyperdb:
Add the following lines near the top of wp-config.php
define(‘WPMU’, true);
require(‘db-settings.php’);
Then add the blow code at the bottom of db-settings.php
// a handy function for mapping blog tables to dataset
function add_blog_tables($ds, $blog_id){
add_db_table($ds, ‘wp_’ . $blog_id . ‘_comments’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_links’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_options’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_postmeta’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_posts’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_terms’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_term_relationships’);
add_db_table($ds, ‘wp_’ . $blog_id . ‘_term_taxonomy’);
}
// add databases
add_db_server(‘global’, 0, ‘mysql3326_1’, 1, 1, ‘localhost:3326’, ”, ‘wpmu_db0’, ‘wpuser’, ‘thepwd’);
add_db_server(‘s1’, 0, ‘mysql3326_2’, 1, 1, ‘localhost:3326’, ”, ‘wpmu_db1’, ‘wpuser’, ‘thepwd’);
add_db_server(‘s2’, 0, ‘mysql3306_1’, 1, 1, ‘localhost:3306’, ”, ‘wpmu_db2’, ‘wpuser’, ‘thepwd’);
add_db_server(‘s3’, 0, ‘mysql3306_2’, 1, 1, ‘localhost:3306’, ”, ‘wpmu_db3’, ‘wpuser’, ‘thepwd’);
// add global tables which are in global database
add_db_table(‘global’, ‘wp_blogs’);
add_db_table(‘global’, ‘wp_blog_versions’);
add_db_table(‘global’, ‘wp_registration_log’);
add_db_table(‘global’, ‘wp_signups’);
add_db_table(‘global’, ‘wp_site’);
add_db_table(‘global’, ‘wp_sitecategories’);
add_db_table(‘global’, ‘wp_sitemeta’);
add_db_table(‘global’, ‘wp_usermeta’);
// add the tables for the first blog (created during wpmu installation)
// the first blog’s tables are in global database
// of course, you can move it to any database you want
add_blog_tables(‘global’, 1);
$dbsnum=3; // 3 additional databases
$blogs_per_db=2; // each database serves 2 blogs
for($db_id=1; $db_id<=$dbsnum; $db_id++){
$dataset = ‘s’ . $db_id;
$max = $db_id * $blogs_per_db + 1; // include
$min = $max – $blogs_per_db + 1; // include
for($blog_id=$min; $blog_id<=$max; $blog_id++){
add_blog_tables($dataset, $blog_id);
}
}
you can find the full post here:
https://huang.yunsong.net/2009/wpmu-hyperdb.html
This configuration takes advantage of the flexibility of use of Hyperdb, you just add databases on the go as you need them…
If you think about an improvement of this setup, you’re welcome to leave a reply.