Multi-DB instructions

Honestly I find the instructions in the readme a bit vague.

Dont want to be spoon fed but a decent guide or tutorial would be great, thanks.

I’ve been putting if off for a while, but now I’m getting alot of signups.

  • Andrew
    • Champion of Loops

    Hiya,

    but what do you do next ?

    You create your databases, setup your db-config.php and then move your tables. Some helpful tools are here: http://db-tools.wpmudev.org/

    How does move_blogs work ?

    Open it up, add in your db details (user, pass, etc) and then run the script.

    Where’s the script to create the DBs for cpanel ?

    We don’t provide a script for cPanel.

    How does it affect plugins ?

    Plugins that properly use the wpdb class should work just fine. If you need to define a global table (tables that reside in your global database) you can define those in db-config.php.

    Thanks,

    Andrew

  • drmike
    • DEV MAN’s Mascot

    There’s a db creation script here: [link removed – drmike] It’s set up to make 256 of those little buggers. Note the xxPASSWORDxx stuff that you have to modify. You’ll need your cpanel username and password along with the mysql user name to get it to run.

    It takes a while. Done that way so not to overload your box.

    If you have root access to the mysql db, just use the tools linked to up above to create the dbs.

  • Klark
    • Site Builder, Child of Zeus

    haha :smiley:

    Might seem like a piece of cake to you guys. But this plugin/tools is a doozy for me. Please just do to “10 step” guide for us. Don’t have to go into much detail, just an outline for everything need to set it up :slight_smile:

  • nickd32
    • The Incredible Code Injector

    Hi gang. First time here, and I’ve just spent 3 hours reading the forums… Still got a couple of noob questions and I’m hoping you can lay some knowledge on me.

    Configuring db-config.php:

    1. [DC IP] What is a “data center IP” and how does that differ from the IPs of each of our DB servers?

    2. [Global Tables] If this is a (fairly) new install of WPMU (no plugins yet), can we omit the add_global_table section from db-config?

    3. [Global Tables] Will we have to revisit this later as we add plugins or does the global DB get populated automatically from here on out?

    4. [DB Servers] Minimum number of DBs to create = 18, right? (16 + 1 Global + 1 VIP for the main blog)

    5. [DB Servers] Regarding the naming schema of the DBs, I don’t have control over what the name of each of my DBs is. When I set them up, the names are assigned (Example: db12345). Do I put that database name in the ‘DS’ column or the ‘NAME’ column or both?

    add_db_server(‘db12345‘, ‘dc1′, 1, 1,’192.168.0.101′,’64.120.23.72’, ‘wpmu_0’, ‘db_user’, ‘db_pass’:wink:;

    add_db_server(‘0’, ‘dc1′, 1, 1,’192.168.0.101′,’64.120.23.72’, ‘db12345‘, ‘db_user’, ‘db_pass’:wink:;

    Configuring move-blogs.php:

    1. Am I correct to assume that db-config.php does NOT need to be configured/uploaded before we run this script?

    2. If that’s true, we must specify the info for the 16+ DBs somewhere in this script. In my case:

    – the hostname for each DB is different

    – the username/password for each DB is different

    – the prefix of the db’s are not the same (other than the naming schema being db12345, db12346, db12347, …:wink:

    Can I set up $newdb_prefix (and the other variables) to be an array that holds this info? Why is the move-blogs.php setup so bare-bones when the db-config.php gives you so much flexibility?

    Thanks for the enlightenment.

  • Andrew
    • Champion of Loops

    Hiya,

    1. [DC IP] What is a “data center IP” and how does that differ from the IPs of each of our DB servers

    It’s just the IP for your db server.

    2. [Global Tables] If this is a (fairly) new install of WPMU (no plugins yet), can we omit the add_global_table section from db-config?

    If you don’t have any custom global tables from plugins, etc then you can comment that section out.

    4. [DB Servers] Minimum number of DBs to create = 18, right? (16 + 1 Global + 1 VIP for the main blog)

    That would be correct if you want to put the main blog in it’s own db.

    5. [DB Servers] Regarding the naming schema of the DBs, I don’t have control over what the name of each of my DBs is. When I set them up, the names are assigned (Example: db12345). Do I put that database name in the ‘DS’ column or the ‘NAME’ column or both?

    I’m afraid that’s going to make it quite difficult to use the move-blogs script. We recommend you use something like YOURSITE_HASH (ex blogsite_a, blogsite_b).

    DS = dataset. It’s either the hash value, ‘global’, or the DS for your VIP blog. The database name goes in the NAME spot. Please look at one of the example config files for an example.

    1. Am I correct to assume that db-config.php does NOT need to be configured/uploaded before we run this script?

    You don’t have to configure it first. However, I usually do.

    2. If that’s true, we must specify the info for the 16+ DBs somewhere in this script. In my case:

    – the hostname for each DB is different

    – the username/password for each DB is different

    – the prefix of the db’s are not the same (other than the naming schema being db12345, db12346, db12347, …:wink:

    You typically just configure the script with your prefix. However, in your case I think you’ll have to recode sections of the script.

    Can I set up $newdb_prefix (and the other variables) to be an array that holds this info?

    I’m afraid this is something that I can’t help with since you can’t specify the name of your databases. You’re going to have to change the move-blogs script to meet your needs.

    Why is the move-blogs.php setup so bare-bones when the db-config.php gives you so much flexibility?

    It’s just a script to move the blogs :wink:

    Thanks,

    Andrew

  • nickd32
    • The Incredible Code Injector

    Thanks, Andrew. I think it will be more trouble than it’s worth at this point to rewrite the script.

    So, my options are to:

    1. Move blogs manually

    2. Start with a fresh WPMU install

    If I were to start with a clean WPMU install (with only the main blog), would there be a need to run move-blogs.php?

    Couldn’t I just set my original DB to be both the ‘global’ DB and the ‘vip’ DB in db-config?

  • Andrew
    • Champion of Loops

    Hiya,

    If I were to start with a clean WPMU install (with only the main blog), would there be a need to run move-blogs.php?

    There won’t be a need to run the script for a fresh install.

    Couldn’t I just set my original DB to be both the ‘global’ DB and the ‘vip’ DB in db-config?

    It would still look for the blogs in the 16 databases. Your best bet is to move the existing blogs to a vip database if that’s what you want to do.

    Thanks,

    Andrew

  • farrarmarklv
    • New Recruit

    I signed up for WPMU Dev just to get the Multi-DB script. What a disappointment.

    Multi-DB needs step-by-step installation instructions so that users of the script have a decent chance of being able to install it. The current install.txt is extremely inadequate.

    Look at the posts in this forum and the need for installation instructions becomes very clear.

  • farrarmarklv
    • New Recruit

    I have a new install of WPMU 2.6.3 running on a server.

    I’ve created the 256 databases and modified db-config.php so that it contains values that correspond to the databases and user account credentials.

    When I copy the files into wp-content as indicated in the installation notes and try to access the blog, I get the message:

    No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance.

    When I remove the db*.php and scripts directory from wp-content I am able to log into the blog again, so it seems that my configuration of the db-config.php file must be the cause of the problem.

    What are the things I should check that might cause this error to occur?

  • farrarmarklv
    • New Recruit

    I did try the installation of WPMU 2.6.3 with the MultiDB files in place, but the install never completed. All that was displayed was the WPMU logo.

    I tried installing with both the “global” and “00” databases that I’d created, but neither worked. Each attempt yielded a blank screen except for the WPMU logo.

    It doesn’t bother me to install WPMU and MultiDB again, but what database name should I be supplying on the initial configuration screen? One of the global, vip or 00-ff databases or a standalone database?

  • trent
    • Site Builder, Child of Zeus

    If you installed it in the global database first off, use that one. If it was something else, then use that one. All that is missing seems to be putting the main blog into the correct DB. Another option might be creating a VIP database and then copying all the main blogs tables into it and setting that up as a VIP database in your db-config.php. That might be the simple solution as having the main blog in it’s own DB isn’t a bad idea anyways :wink:

  • Luke
    • The Crimson Coder

    For blog_id 1, the tables for it should be in c, c4, or c4c depending on how many db’s you have. Since your using 256, it should be in c4.

    Just stick the global tables in your global db, then the wp_1_cccc tables in db c4. Should be fine from there.

    Or yeah, putting your main blog tables in a VIP db is a good thing too. You could even call that db “home” to keep it simple.

  • sparkspark
    • New Recruit

    Ignore this. I’ve figured the problem out. I’m going to go walk away from my PC for a few as this has been the single most aggravating plugin install I have ever worked with. The documentation is non-existent, the usage is quite literally a guessing game. Hm … I’ll use databases numbers 00 thru 256. Nope! I can’t! The script magically only accepts hex for the db number! Nice of you to tell me that in the example. “move-blogs.php” had to be modified before it worked. It seems to think “move_blogs.php” is the same as “move-blogs.php”.

    Seriously. Fix your documentation. “Read the code to figure it out” is NOT an acceptable answer to people pointing out the lack of documentation. I cannot believe how insane the setup was and all the guessing I had to do to set this up. I mean seriously.

  • James Farmer
    • CEO (of WPMU DEV, honest)

    We’re definitely aware that the documentation could be better and are working pretty hard to improve it along with the other aspects of the site.

    This helps as it guides us towards what we should add etc.

    But I think you;d agree that the priority at the moment should be code and development… once we’re big, fat and successful we can hire a technical writer :slight_smile: At teh moment, it’s just a matter of priority.

  • sparkspark
    • New Recruit

    How about a function guide? It would take you what … all of five minutes to write up a guide that details the usage of each function? That alone would have saved me a lot of time and frustration. Honestly, meaningful documentation for this would take, at most, thirty minutes to come up with. Having worthless documentation on your code is only going to be a deterrent to potential users.

  • sparkspark
    • New Recruit

    Point is, I didn’t know that. How would I? I’m not a WPMU guru. You may know that, but a lot of people who are looking at WPMU and Multi-DB for the first time, such as myself, will -not- know that. All we know is we have to somehow configure it, and the support forum post shows the developer saying, “Read the code to figure it out.” How much do you want to bet that not everyone wishing to use Multi-DB will know PHP well enough to read the code and figure it out?

    Anyway, </rant>

  • drmike
    • DEV MAN’s Mascot

    Actually they should know php fairly well. One of the requirements of running a mu install is a basic working knowledge of php. That way you can provide support for those folks signing up with your site. If you’ve not read it, this is a good read: Is MU for me?

    And to be honest, there’s at least 6 sites on the net that list and explain the wordpress functions in fairly decent detail. I believe at least one of them have added wpmu to their lists.

    I’d rather have James and Andrew working on bugs instead of duping other people’s efforts.

    I still don’t see what the problem is with the install instructions is. Maybe I’m just tired.

  • sparkspark
    • New Recruit

    The install instructions are nothing more than a “put these files here” and nothing else. Spending half an hour typing up a meaningful document is NOT going to cause them to not be able to help people and fix bugs. If anything, it’ll save them time in the long run.

  • andrea_r
    • The Incredible Code Injector

    Actually, part of the issue with the install instructions is that it says you can create the dbs with whatever names you want, but the code clearly expects them to be named in a certain way.

    They’re more of a guideline and work well if you’ve done something like it before. You know I had trouble setting it up the first time. (no jokes please, I’ll rip your head off in my mood today).

    So. IMNSHO it definitely needs better instructions and YES I have actually planned on writing them up myself. :slight_smile:

  • pluzon
    • Design Lord, Child of Thor

    The Multi-DB plugin Installation button says:

    “Simply download the package and follow the detailed installation and operation instructions – drop in at teh forums for help and support if you have any issues.”

    The instructions in the download package do not adequately describe how to configure this plugin. Are more detailed instructions located somewhere else?

    Here are the “detailed” installation instructions in the download .txt file:

    Plugin Name: Multi-DB

    Author: Andrew Billits

    Files:


    db.php – goes in /wp-content

    db-config.php – goes in /wp-content

    move-blogs.php – goes in /wp-content/scripts

    db-config-sample-16.php – <<<EXAMPLE FILE ONLY>>>

    db-config-sample-256.php – <<<EXAMPLE FILE ONLY>>>

    Instructions:


    1) Place the files in the specified directories

    2) Configure db-config.php

    Tools: http://db-tools.wpmudev.org/

    Notes:


    1) You can name your databases cute names like “Turkey” and “Ham” if you would like. However, over time you will find yourself doing much less work if you just name the databases something like “wpmu_a, “wpmu_1”, etc.

    2) While support IS included with your WPMUDEV Premium account, we will not install this on your server for you. Support is limited to fixing bugs and adding new features.

    3) The tool provided to move blogs to your new databases is provided “as is”. We are not to be held responsibly for any damage it may cause.

    4) Always make sure you have a valid backup before attempting anything database related.

    Disclaimer:


    – This Software is provided As IS. We are not responsible for any damage caused by this software.

    – While we do test each version prior to release, it is ultimately up to you to create backups before installing or upgrading this software.

    – This software is intended for advanced users. If you do not have any grasp of PHP, MySQL, or Apache, we ask that you not use this software.

  • Mason
    • DEV MAN’s Sidekick

    Hiya Pluzon,

    First off, welcome to WPMU DEV! :smiley:

    We’re actually working through a totally revamped version of the instructions at the moment. Hopefully, will have them out this week, but good documentation takes time.

    Until then, we do have a forum dedicated to Multi-DB:

    https://premium.wpmudev.org/forums/forum/multi-db-support

    At the top, you’ll notice a sticky thread which provides a ton of specific information on how to get this setup. If you want to dive in now. I’d suggest reading through that.

    Thanks! And again, welcome! :smiley:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.