Drupal 6 and MySQL master & slave Replication on EC2

Events happening in the community are now at Drupal community events on www.drupal.org.
akhan's picture

Hello,

We are setting up a server farm on EC2 to host a site built on Drupal 6. I am reaching out to the this community to seek help in setting up the MySQL master-slave replication where Drupal will write to the mast DB and read from the slave DB. Has anyone done this successfully on EC2?

We are using Scalr.net as the front end cloud application and its lets you set-up the MySQL master-slave instances quite easily. Where I need help is how to tell Druapl to write to the master DB and read from the slave.

Many thanks for help in advance.

Regards,
Arshad

Comments

I believe it's not possible

yang_yi_cn's picture

I believe it's not possible with Drupal 6, or at least without patching the core and many modules heavily.

It's due to the fact that Drupal 6 uses db_query() function with doesn't distinguish INSERT and SELECT.

In order to improve that situation, Drupal 7 changed the DB layer and have db_insert() and db_select() functions for writes and reads. So it might be better to try Drupal 7 if you do need to have master / slave setup.

Oh I see. I thought one would

akhan's picture

Oh I see. I thought one would be able to do this.

This would require us to upgrade to D7 which we can't do just now. And when we upgrade to D7, probably the best would be to upgrade to Press Flow 7?

Many thanks for your help.

Arshad

There is no such thing as

dalin's picture

There is no such thing as Pressflow 7, but you can easily send reads to the slave on Pressflow 6. And with a bit of trickery you can set specific views to read from the slave as well:

http://www.lullabot.com/articles/querying-slave-database-with-views

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

Pressflow 7 is alive -

moshe weitzman's picture

Pressflow 7 is alive - https://github.com/pressflow/7. Not much info yet.

Replication

matthewv789's picture
  1. Ideally you want to split you reads evenly, not send them all to the slave.
  2. Drupal 6 doesn't know how to connect to more than one db - use Pressflow.
  3. Even Pressflow or D7 will send 90%+ of queries to the master. The modules need to be rewritten, too.
  4. Better to use layers of caching to reduce number of queries in the first place. Most sites don't actually need a slew of servers.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: