• Resolved j63

    (@j63)


    I’m trying to get SharDB to work and followed the instructions in readme.txt. I now have the following databases:

    foo_bar_clone – the old monolithic database (a clone of the live database on a dev machine)
    foo_bar_global
    foo_bar_home
    foo_bar_vip1 through foo_bar_vip4
    foo_bar_00 through foo_bar_ff

    db-settings.php has the following settings at the top:

    define( 'DATACENTER', '' );
    $shardb_hash_length = 2;
    $shardb_prefix = 'foo_bar_';
    $shardb_dataset = 'global';
    $enable_home_db = true;
    $num_vipdbs = 4;
    $shardb_local_db = true;

    I have one database server set up:

    add_db_server( 'global', 0, '', 1, 1, DB_HOST, DB_HOST, $shardb_prefix . 'global', DB_USER, DB_PASSWORD );

    wp-config.php has not been modified except for require()ing db-settings.php.

    The import script runs through and the databases are populated. After copying db.php into wp-content I can open individual blogs and they seem to work. However, when I try to do anything in the network admin I get an error page telling me that the database wp_blogs could not be found in foo_bar_clone.

    Apparently WordPress still tries to use the old monolithic database and apparently it doesn’t work. Removing db.php restores full functionality. I have made a mistake somewhere but I can’t spot it.

    How can I figure out what went wrong? And is there an easy way to figure out which databases the new database class is trying to talk to?

    https://wordpress.org/plugins/shardb/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    First, change

    $shardb_dataset = 'global';

    to something other than global.

    Where did you add this code?

    add_db_server( ‘global’, 0, ”, 1, 1, DB_HOST, DB_HOST, $shardb_prefix . ‘global’, DB_USER, DB_PASSWORD );

    You do not need to add any DB registration code.

    Did you edit the sample config lines in the db-settings.php or add your own below?

    Thread Starter j63

    (@j63)

    The define() and add_db_server() calls turned out to be unchanged from the original file. The other settings were written below the comment block describing the variables.

    Changing $shardb_dataset‘s value didn’t seem to help. I still get the same error except that I now also get a database error when opening blogs – WordPress now can’t find the wp_site table anymore. It’s definitely in the foo_bar_global database, though.

    I tried var_dump()ing the $db_servers and $db_ds_parts variables at the end of db_settings.php but couldn’t find anything that seemed obviously wrong. Still I’ll describe it in case something is wrong and I’m not seeing it.

    $db_servers is populated with two datasets, the global dataset containing exactly one entry (at $db_servers['global'][0][0]) and the foo_bar dataset containing one entry per non-global table, with incrementing part.

    $db_ds_parts assigns databases to partitions, with foo_bar_global being assigned to global_0 and the others to foo_bar_(incrementing number).

    Thread Starter j63

    (@j63)

    Bizarrely enough the problem now resolved itself despite me not touching anything. Perhaps some cache-related issue that ended up with my browser confusing WordPress. Waiting seems to have helped.

    Still, thanks for the support.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Database connection errors’ is closed to new replies.