I read this question MySQL master/slave replication not working and its answer:
Using slave databases is barely implemented in Drupal core. If you are developing your own modules then calls to db_query need to specify that they want to use the slave database using the $options array. See DatabaseConnection::defaultOptions for how to set this array.
Is there a way without killing kittens hacking the core to get db_query()
and db_select()
to make more slave SELECT queries ?
By default, these functions will query the master unless specifically told to query the slave (see their API). You have to write db_query($query, $args, array('target' => 'slave'))
in order to query the slave and the core (and all the modules) aren't written to achieve this.
Only search (see the slave part) and aggregator seems to leverage this.
Edit: Oct, 25
I saw pressflow 7 is out but I'm not sure if it helps a lot right now.
I haven't found something relevant so let's try a little bounty to help this getting an answer.
Edit: Oct, 31
I'm mainly worried about Crell's comments regarding this topic: What to do with slaves?.
Mainly, is there troubles if I send SELECT
queries to the slave, what happens with delays in the replication and the fact that I may want to do a node_load()
just after saving a new node.