Skip to content

Instantly share code, notes, and snippets.

@mustafauysal
Last active February 24, 2019 13:44
Show Gist options
  • Save mustafauysal/97ea9a140752c2e004e7425f00e0c6f4 to your computer and use it in GitHub Desktop.
Save mustafauysal/97ea9a140752c2e004e7425f00e0c6f4 to your computer and use it in GitHub Desktop.
HyperDB config examples
<?php
// MASTER machine
$wpdb->add_database(array(
'host' => DB_HOST,
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 1,
'read' => 0,
));
// SLAVE 1
$wpdb->add_database(array(
'host' => '192.168.1.2',
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 0,
'read' => 1,
'dataset' => 'global',
'timeout' => 0.4,
));
// SLAVE 2
$wpdb->add_database(array(
'host' => '192.168.1.3',
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 0,
'read' => 1,
'dataset' => 'global',
'timeout' => 0.4,
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment