Alexandru Vornicescu & Rodrigo Primo:
Yeah it’s possible, look, you only need to edit db-config.php
the db.php class shouldn’t be modified. Is marked as solved because i solved it days before.
I will use spanish because i’m mexican and i wrote it previously in spanish (now i’m usin copy-paste), use a traslator if required.
I made it while doing scholar practices at a newspaper factory, they use WordPress and were required to split databse because there were a huge DB (4GB DB size)
This is an example from a distributed database wich has 3 DB, but you can do more.
1DB for all wp-tables except posts
2DB just for posts. (
2. database “B” will have tables for posts up to ID 1000
3. database “C” will have tables for posts form ID 1000 to 2000
)
This is just an example, adapt it to yur case (sorry my bad english)
/**
* Considere que ‘wp-develop’ es la BD maestra, la BD ‘wp-develop1’ y ‘wp-develop2’
* contienen los posts pero en fragmentos.
*/
/**
* Base de datos principal (no posts)
*/
$wpdb->add_database(array(
'host' => DB_HOST,
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
/*'dataset' => 'global',*/
));
/**
* Base de datos para posts que impide escritura y
* no prioriza lectura (posts de a?os o semestres anteriores)
* Es posible partir ésta BD aun en más.
*/
$wpdb->add_database(array(
'host' => DB_HOST,
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => 'wp-develop2',
'write' => 0,
'read' => 3,
'dataset' => 'news',
));
/**
* Base de datos para posts a escribir/leer, máxima prioridad
* en escritura/lectura (a?o actual o semestre actual)
*/
$wpdb->add_database(array(
'host' => DB_HOST,
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => 'wp-develop3',
'dataset' => 'news',
));
/**
* Reconoce tablas “separadas” de la B.D. y las integra
* En ‘News’ dataset, donde news son los posts.
*/
$wpdb->add_table('news', 'wp_posts');
$wpdb->add_table('news', 'wp_postmeta');
If u have questions feel free to posts them, i’ll help you. Greetings