This is what I used to get HyperDB running with HAProxy. HAProxy listens on 6306 (MySQL master) 3306 (MySQL slaves):
db-config.php
….
$wpdb->add_database(array(
‘host’ => ‘haproxy:6306’, // If port is other than 3306, use host:port.
‘user’ => ‘user’,
‘password’ => ‘password’,
‘write’ => 1,
‘read’ => 0,
‘name’ => ‘wp_mu’,
‘dataset’ => ‘global’,
‘timeout’ => 0.2,
));
$wpdb->add_database(array(
‘host’ => ‘haproxy:3306’, // If port is other than 3306, use host:port.
‘user’ => ‘user’,
‘password’ => ‘password’,
‘write’ => 0,
‘read’ => 1,
‘name’ => ‘wp_mu’,
‘dataset’ => ‘global’,
‘timeout’ => 0.2,
));
….
wp-config.php
….
/*
define(‘DB_NAME’, ‘wp_mu’);
define(‘DB_USER’, ‘user’);
define(‘DB_PASSWORD’, ‘password’);
define(‘DB_HOST’, ‘haproxy’);
*/
….
Thats about it.