Support » Plugin: HyperDB » Replication is not working

  • Hello,

    Please find below configuration snnipet of db.php file.how to check write query goes to rds maria master database and read query goes to rds read replica.

    $wpdb->add_database(array(
    ‘host’ => ‘masterdatabase’, // If port is other than 3306, use host:port.
    ‘user’ => ‘xxxxx’,
    ‘password’ => ‘xxxxxx’,
    ‘name’ => ‘xxxxxx’,
    ‘write’ => 1, // master server takes write queries
    ‘read’ => 0, // … and read queries
    ));

    /**

    This adds the same server again, only this time it is configured as a slave.
    The last three parameters are set to the defaults but are shown for clarity.
    */
    $wpdb->add_database(array(
    ‘host’ => ‘readreplicadbatabase’, // If port is other than 3306, use host:port.
    ‘user’ => ‘xxxxx’,
    ‘password’ => ‘xxxxxx’,
    ‘name’ => ‘xxxxx’,
    ‘write’ => 0,
    ‘read’ => 1,
    ‘dataset’ => ‘global’,
    ‘timeout’ => 0.2,
    ));
    It would be greatful if you suggest any changes to achieve this.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Your question is a bit confusing.. you say replication is not working. This is clearly stated on the plugin page… Please understand what you are installing.

    HyperDB does not provide replication services. That is done by configuring MySQL servers for replication. HyperDB can then be configured to use these servers appropriately, e.g. by connecting to master servers to perform write queries.

    If the issue is with Replication, your RDS may be misconfigured.

    Now if you are saying your site is not connecting to the READER, then try raising the value of the timeout. I raised mine to be 0.3

    • This reply was modified 1 year, 5 months ago by SoN9ne.
Viewing 1 replies (of 1 total)
  • The topic ‘Replication is not working’ is closed to new replies.