Support » Plugin: SharDB » SharDB 2.7.5 & WP 3.1 Multisite Issues

  • Resolved Cam


    I am currently using/installing SharDB to break up (partition) my database.
    SharDB version is: 2.7.5 (Dev version)
    I am trying to navigate the blog network into a 16db hash and my table structure is (rbs201db_[0-9a-f] and my global table is rbs201db_global. I am not using the home db or vipX config.

    There are/were three issues:
    1. Database migration tool created empty tables (and it didn’t advance automatically as I found out after applying this patch. Thanks @webraket. (I moved the global tables manually after using the migration tool.)

    2. After applying fix #1, all site admins seemed to work (unsure of blog 1 though since I was trying to access the admin settings) however the network admin section was inaccessible. Also have a feeling that blog 1 site admin was not available either because of a hyperlink request I looked at under Sites in one of the blog site admins. (This is blog network nested three directories deep, which could be the issue.) Fixed–or at least appear to be fixed–by copying the blog 1 tables into the global db. Since blog 1’s tables are in two places, I’d like to find a fix so that there isn’t unnecessary duplication if only one of the two places is utilized.

    3. After applying fix #1 & #2, the extra column under network/sites is there to show what partition each site is on, but none of the fields are populated with any data. This is probably a 3.1 network admin upgrade issue, but a fix would be nice since I am not 100% certain I can get rid of my old database now. (I’m about 95% sure now that problems #1 & #2 fixed since I don’t think there is any reference back to the original db, but a visual clue would be nice. :))

    My WP is a 3.0.x site upgraded to 3.1 — aka it was never wpmu. I think my sql server is 5.0.83 & my php version is PHP Version 5.2.17

    Thank you in advance for any and all help and thanks Ron (@wpmuguru) for a great plugin.

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


    On the network admin column, yes, that’s a 3.1 network admin upgrade issue. IIRC, the hook had a name change from blog to site. I’ll see if I can get that one into the next release.

    On #2, is that an upgraded MU or a network you created after 3.0?



    This is a 3.0.x install that was upgraded to 3.1. WPMU has never been involved. (funny thing is that, I started my website the day that WP 3 came out–the root site that is. This Multisite that is several directories deeper into the site was started later, probably with 3.0.2 or 3.0.3 and was upgraded.)

    Thanks for the update.



    Hi Ron,
    Per your suggestion the following lines are modified in shardb-admin.php:
    Line 41 is now:
    remove_action( 'manage_sites_custom_column', 'shardb_blog_field' );

    Line 54 is now:
    add_action( 'manage_sites_custom_column', 'shardb_blog_field', 10, 3 );

    With these two changes, #3 is fixed.

    #2 and all links to & from seem to work properly while I have blog id 1’s tables included in global db, however, the database column (that now works) says that this blog is in db_c.

    This seems to be the only remaining potential issue. Thank you for all your assistance. 🙂



    FYI for future onlookers, db.php is installed after using the migration tool. This was not in the documentation very clearly (at least for me), however the documentation may be updated to reflect a clearer installation:

    Here is the steps I took to install SharDB:

    1. Create database structure per the instructions document:
      All db should have the same username and password as your source db (as configured in wp-config.php)
      Global db should end with ‘global’
      Databases should end with a one/two/three md5 hash suffix. (Meaning 0-9 and a-f for a 1 md5 hash suffix) and the same prefix as you will specify in the db-settings.php file
      My example db names are:
      Prefix: mydb_
      Databases: mydb_global, mydb_0, mydb_1, mydb_2, …, mydb_9, mydb_a, mydb_b, …, mydb_f.
      (Seventeen tables total for a hash_length = 1 scenario. Also include a table that ends with home or vip1, vip2, etc. if you intend to use those features.
    2. Open db-settings.php and configure the file to your settings.
      For me, uncommenting the first three options [hash_length/prefix/dataset] and making sure that the section is uncommented (no /* & */ on either end. Use visual editor that is color-coded if in doubt) were all I used. May be more complex if you are utilizing more features.
    3. Install db-settings.php in same directory as wp-config.php.
    4. Add line: require('db-settings.php'); in wp-config.php right above the line: /* That’s all, stop editing! Happy blogging. */
    5. Install shardb-admin.php in wp-contents/mu-plugins/ [create directory if it doesn’t exist].
    6. Log in and use the migrate tool to migrate your database (currently Tools–>SharDB Migration or something like this)
    7. With the migration tool working properly it should proceed automatically through your sites. (This was something I wasn’t aware of and spent lots of time creating blank tables).
    8. Install the db.php file in the wp-contents directory.
    9. Locate the global db tables and export them from your source db and import them into your global db. (Ron has mentioned adding this into a future version of the migration tool, but currently this is a necessary step if you are moving to a completely new db structure.)
    10. Update the DB_NAME field in wp-config.php to your new global db.

    With what has been noted above as current temporary code issues that will be resolved, these are the steps I took to install and configure SharDB. Hope this helps anyone who may currently be struggling with installing/configuring this plugin.

    Thanks Ron (@wpmuguru) for a great plugin and if this is helpful/useful, feel free to copy/paste/add/edit any of these instructions into the documentation to help others. 🙂

    Plugin Author Ron Rennick


    “This is a 3.0.x install that was upgraded to 3.1. WPMU has never been involved.”

    You mentioned you had the main site’s tables in two databases. If you had an upgraded MU then shardb looks for those tables in the ‘c’ database. In a netowrk created since 3.0 shardb looks in the global database.

    Thanks for writing up the instructions.



    Currently my host is experiencing difficulties, so I can’t access my site. (Grr for those reasons.) When I get it back up I will experiment and remove Site #1 from db_c and see if it breaks anything. Does the migration tool check for this–or is there even a way to check for this? May be worth adding a feature or option to avoid the main site from being moved to the wrong spot when global migration gets incorporated.

    Thanks for the clarification on how MU differs from the new network.



    I just removed the site #1 from db_c (since it is in the global db) and everything appears to work properly. The only thing I notice is that the partition column in the sites menu still shows it in db_c when it really isn’t, but this is a minor issue in my mind. 🙂

    Thanks Ron (@wpmuguru) for all your help and I will mark this issue resolved. (Isn’t it nice to have resolved support topics. 🙂

    Hi Ron @cam,

    I am try to install the shardb plugin to my site. I want my site to act as master in one host and slave in another host..

    In the installation, db-setting.php I think,the first line is to access the external database.

    define( ‘DATACENTER’, ” );

    can you give me example for this, how it should be? how to find the datacenter for the host..




    Since this is a different issue/inquiry, you may want to start a new thread. I’d love to help you figure this out, but this configuration is above my ability level.
    Thanks for asking, and I’m sure there are others like Ron here on the forum who can help.

    Have a great day!


    Plugin Author Ron Rennick


    @mathanraj – use HyperDB if you are looking to use a master/slave setup. I have some of the framework in place for that in SharDB, but it’s not complete at this time.

    Thanks @cam @ron

    I also try to install the hypedb, but while seeing the changelog of hyperdb

    I saw this..
    Removed support for WPMU and BackPress
    Is it now support for wpmu? can i use hyperdb in wpmu?



    WordPress MU is no longer in development. WordPress 3 with multisite capabilities is what has replaced wpmu.
    I don’t know about backpress but I imagine it is in a similar boat.
    If you are running a WordPress 3 site, then the lack of wpmu support shouldn’t bother you.

    Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    Cam is correct. Newer version of the plugin do not support wpmu, becasue if you’re still using it, you’re behind. Its last version was 2.9.2.

    Upgrading from that to 3.0 and above means you’re on multisite.


    @cam, @ron, @andrea, I opened a new thread regarding Hyperdb installation can you help?

    Plugin Author Ron Rennick


    Sorry, I have not looked at the last version or two of HyperDB at all. The guys who maintain HyperDB are top notch devs, so I never hesitate to refer people to it when it will suit their needs better than SharDB.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘SharDB 2.7.5 & WP 3.1 Multisite Issues’ is closed to new replies.