WordPress.org

Forums

HyperDB
my config file seems to be ignored (10 posts)

  1. lazerramm
    Member
    Posted 4 years ago #

    Hi,

    I have set up db-config.php in my WP root dir. I have not edited the code other than to add my databases

    $wpdb->add_database(array(
    'localhost' => DB_HOST, // If port is other than 3306, use host:port.
    'MY_user' => DB_USER,
    'bar' => DB_PASSWORD,
    'wpdb' => DB_NAME,
    'write' => 1,
    'read' => 1,
    ));

    /**
    * 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(
    '192.168.5.5' => DB_HOST, // If port is other than 3306, use host:port.
    'wp_user' => DB_USER,
    'foo' => DB_PASSWORD,
    'wpdb' => DB_NAME,
    'write' => 0,
    'read' => 1,
    'dataset' => 'global',
    'timeout' => 0.2,
    ));

    when i try to connect I get this in the mysql log

    Access denied for user 'apache'@'localhost' (using password: NO)
    NOTE: the web server runs as the user "apache" and all files have read access for that user

    In the browser i get taken to the WP first time install page.

    why doesn't WP see the values from my db-config.php file

    http://wordpress.org/extend/plugins/hyperdb/

  2. tmuka
    Member
    Posted 4 years ago #

    I'm by no means the expert on this, but I believe you have the order of your array variables index and values switched.

    may want to try something like this instead...

    $wpdb->add_database(array(
    'host'=>'192.168.5.5', // If port is other than 3306, use host:port.
    'user' => 'wp_user',
    'password' => foo,
    'name' => 'wpdb',
    'write' => 0,
    'read' => 1,
    'dataset' => 'global',
    'timeout' => 0.2,
    ));

    Hope this helps!

  3. mathanraj
    Member
    Posted 4 years ago #

    Yes, tmuka is correct, you are switched the values and variable index..

    I am also trying to config db-conifg.php to act as master/slave setup..

  4. ds123
    Member
    Posted 4 years ago #

    can anyone please help me with this config ... am i supposed to enter any values in for the master? i have entered all the values for the slave but the slave is doing nothing meaning i do show processlist and nothing is happening ... any advice would be greatly appreciated .... also i created a user@the-ip-the-master on the slave mysql server and granted permissions to same database the master uses ...i don't get any errors meaning site is running with hyperdb activated but seems to be only using master

    /** Sample Configuration 1: Using the Default Server **/
    /** NOTE: THIS IS ACTIVE BY DEFAULT. COMMENT IT OUT. **/

    /**
    * This is the most basic way to add a server to HyperDB using only the
    * required parameters: host, user, password, name.
    * This adds the DB defined in wp-config.php as a read/write server for
    * the 'global' dataset. (Every table is in 'global' by default.)
    */
    $wpdb->add_database(array(
    'host' => DB_HOST, // If port is other than 3306, use host:port.
    'user' => DB_USER,
    'password' => DB_PASSWORD,
    'name' => DB_NAME,
    ));

    /**
    * 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(
    'theprivateipofmyslave' => DB_HOST, // If port is other than 3306, use host:port.
    'myslaveusername' => DB_USER,
    'iputmypasswordhere' => DB_PASSWORD,
    'my_wordpressdatabase_wordpress' => DB_NAME,
    'write' => 0,
    'read' => 1,
    'dataset' => 'global',
    'timeout' => 0.2,
    ));

    /** Sample Configuration 2: Partitioning **/

  5. tmuka
    Member
    Posted 4 years ago #

    you're assigning your variables backwards too, read the post above my last one...

    eg.
    'host'=>'192.168.5.5', // If port is other than 3306, use host:port.

  6. lazerramm
    Member
    Posted 4 years ago #

    Thank You all for your help.

  7. Bruno Sacco
    Member
    Posted 4 years ago #

    My setup:

    2 dedicated servers, 8GB ram each.

    1 apache(worker) + varnish + mysql master

    1 memcached + mysql slave

    HyperDB works great, the master only accepts writes, all reads go to the slave server.

    http://dueledecirlo.paraguay.com is the website, any questions just ask.

    Thanks.

  8. choopafrank
    Member
    Posted 4 years ago #

    @bruno

    On your current setup how much traffic are you getting.. Currently i was testing this out with varnish on the front with nginx+php-fpm backend and seperate db server and memcache machine i notice when i ran benchmark test using siege with 200-300 concurrent connections the backend would die quickly untill the cache has been populated in varnish.

  9. gulflee
    Member
    Posted 3 years ago #

    abit silly Q, everythings setup. but to test is working

  10. Jay Versluis
    Member
    Posted 3 years ago #

    @gulflee

    Best thing to do is to switch one server off and see if the website is still alive. I do this with

    service mysqld stop

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • HyperDB
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags