1 Blog, 1 Database

Is it possible to use the Multi-DB plugin to create a 1 blog to 1 database situation? I am looking at setting up about 30-40 “blogs” that will have thousands of posts each – up to 100,000 – and would want them each to have their own DB.

After reading through all the docs and playing around I am guessing that the bet way would be to use the plugin and add each blog as a VIP blog with it’s own db?

How do I configure the blogs to use one of the vip dbs and not the regular 16/256 databases?

  • Andrew
    • Champion of Loops

    Hiya,

    Is it possible to use the Multi-DB plugin to create a 1 blog to 1 database situation?

    It’s possible but it’s not something I would recommend.

    After reading through all the docs and playing around I am guessing that the bet way would be to use the plugin and add each blog as a VIP blog with it’s own db?

    Correct.

    How do I configure the blogs to use one of the vip dbs and not the regular 16/256 databases?

    Take a look at db-config-sample-16.php.

    This line adds a vip db to the config:

    add_db_server('vip1', 'dc1', 1, 1,'64.120.23.72','192.168.0.101', 'wpmu_vip_1', 'db_user_name', 'db_user_name_pass');

    This line adds a blog (blog id = 1) to the vip db:

    add_vip_blog(1, 'vip1');

    Thanks,

    Andrew

  • notomato
    • WPMU DEV Initiate

    Thanks Andrew – can you expand on why you wouldn’t recommend?

    I might be misunderstanding how Multi-DB works but am I correct in saying that it doesn’t automatically balance out all blogs over all DBs? So if I have 16 DBs with 30 blogs, depending on how those blogs are named they will go into one of the 16 DBs but we could have 10 DBs used and 6 not?

    I am thinking that I do not have enough blogs to guarantee even coverage, but the number of posts will mean that they should definitely be split out.

  • Andrew
    • Champion of Loops

    can you expand on why you wouldn’t recommend?

    A single table can hold millions of records and a single db can hold thousands of tables. If you were splitting the posts over numerous tables that would be one thing but you’re not. Access two 100K row tables in a single db really won’t be much different than accessing them in separate databases.

    I might be misunderstanding how Multi-DB works but am I correct in saying that it doesn’t automatically balance out all blogs over all DBs?

    Blogs are spread over the db based on the first few characters of an md5 hash. So they aren’t spread evenly but it’s pretty close.

    Thanks,

    Andrew

  • drmike
    • DEV MAN’s Mascot

    Also remember that for each database you create, a subdirectory holding that database is created within the mysql structure. You’ll run into the same problem as a default wpmu install when you have 32k of those subdirectories or whatever your OS limits you to.