SharDB, HyperDB and Multi-DB = Part 2

Part 1 is here.




HyperDB plugin is the implementation of replication property of WP Hyperdb. HyperDB plugin requires a master DB and a number of slaves are connected to master DB. Read and/or write permissions can be assigned to each databases. In this setup, the slaves have the same data, and act as fail over and load distribution nodes. If a database fails or if HyperDB cannot find something on a database, it auotmatically switches to another slave.


The databases can be in same or different servers. We must configure details of each database separately.


Integration Steps

  • Download HyperDb plugin and extract it.
  • Make the following changes in `db-config.php`.
    • Add master db configuration to $wpdb->add_database() at line # 217
    • Add configuration of master DB again on $wpdb->add_database at line # 228
  • Deploy `db-config.php` in the directory that holds `wp-config.php`. This may be the WordPress root or one level above. It may also be anywhere else the web server can see it.
  • Deploy `db.php` to the `/wp-content/` directory. Simply placing this file activates it. To deactivate it, move it from that location or move the config file.