The MU forums have moved to WordPress.org

Installing SharDB (7 posts)

  1. jimgroom
    Member
    Posted 11 years ago #

    So anyone else have some experience setting up/moving to SharDB from the Multi-DB setup provided at WPMuDEv. I've been looking at the db-settings file as I begin the process, and I just wanted to be clear.

    I have 16 DBs (actually 18 with a global and 1 VIP DB) and the are named wpmu_global wpmu_0 through wpmu_9 and then wpmu_a through wpmu_f, and finally wpmu_vip1.

    I guess my very first question is, would this be considered a hexidecimal based hash? If so great, then I think the following settings would be right for configuration. If not, anyone have a suggestion of how else I might declare the DBs?

    // If you have multiple datacenters you can come up with your own datacenter
    // detection logic (php_uname?). This helps ensure the web servers try to
    // connect to the nearest database servers first, then distant ones.
    define( 'DATACENTER', '' );
    
    function add_slave($read, $host, $lhost = '', $user = DB_USER, $password = DB_PASSWORD) {
    	global $slaves;
    	$slaves[] = compact('read', 'host', 'lhost', 'name', 'user', 'password');
    }
    
    /* Add your configuration here */
    
    /* Use this configuration for a hexidecimal based hash 
    
    Ex. you have 256 databases that follow the naming convention acct_wpmuXX
    where XX is the hexidecimal hash for the blog DB
    
    // how many characters of hexidecimal hash
    $shardb_hash_length = 1;
    // what is the prefix of your blog database shards (everything before the hexidecimal hash)
    $shardb_prefix = 'umwblogs_wpmu_';
    // set a string to be used as an internal identifier for the dataset
    $shardb_dataset = 'umwblogs';
    // do you want to put your primary blog (blog_id 1) in its own 'home' database?
    $enable_home_db = true;
    // how many, if any, VIP databases do you have?
    $num_vipdbs = 1;
    // add this to set the write master read priority (default 1)
    $shardb_master_read = 99;
    // add this if all of your databases are on a local server
    $shardb_local_db = true;
    // use this function to add a read slave host
    add_slave($read_priority, $hostname, $local_hostname, $user, $password);

    ____________

    Notice I didn't put in any information for the datacenter, should there be an IP address there, and I don;t believe I have a slave master situation running with this given I am on one server. But any clarification of what I might be missing here would be great. Additionally, is there information I should be filling out elsewhere in this file, even if it says your good, stop editing?

    Finally, and to show what a complete loser I am, I believe these lines are commented out through this line

    /* Use this configuration for a hexidecimal based hash

    I imagine I should get rid of that so these settings work, right?

    Idiotically yours,
    Jim Groom

  2. wpmuguru
    Member
    Posted 11 years ago #

    If your full DB names are umwblogs_wpmu_0 through f, then that's the right shardb_prefix. If they are wpmu_0 through f then it should be wpmu_.

    Unless you are running MySQL replication the
    $shardb_master_read = 99;
    is unnecessary. Also, by the same token don't add slave hosts unless you have replication slaves.

    Otherwise the config looks correct.

  3. jimgroom
    Member
    Posted 11 years ago #

    Awesome Ron, I love you!!!

  4. jimgroom
    Member
    Posted 11 years ago #

    Actually, one last question, should I comment out these lines:

    define( 'DATACENTER', '' );
    
    function add_slave($read, $host, $lhost = '', $user = DB_USER, $password = DB_PASSWORD) {
    	global $slaves;
    	$slaves[] = compact('read', 'host', 'lhost', 'name', 'user', 'password');
    }

    Or leave them as is?

  5. wpmuguru
    Member
    Posted 11 years ago #

    Leave those there. The DC constant is referenced in the db code. Setting it to an empty string means your DBs are local.

  6. jimgroom
    Member
    Posted 11 years ago #

    Excellent, thanks again.

  7. jasperespejo
    Member
    Posted 11 years ago #

    Hello. I would like to use this plugin, but I'm not a web developer and am lost on where to start. Could you point me to any online resource on how to set this up assuming:

    1. fresh wpmu install
    2. wpmu with existing user blogs

    Thanks!

About this Topic

  • Started 11 years ago by jimgroom
  • Latest reply from jasperespejo