Best implementation for MySQL replication with Rails 3?

Posted by vonconrad on Stack Overflow See other posts from Stack Overflow or by vonconrad
Published on 2010-12-24T00:46:31Z Indexed on 2010/12/24 0:54 UTC
Read the original article Hit count: 298

We're looking at potentially setting up replication for our primary MySQL database, and while setting up the replication seems pretty straight-forward, the application implementation seems a bit murkier.

My first idea would be to set up a master-slave configuration and RW-splitting, with all write queries (CREATE, INSERT, UPDATE) going to master, and all read queries (SELECT) going to slave. Having read up on it, it seems that there are essentially two options for how to implement this with our app:

  1. Using an independent middleware layer for all MySQL connections, such as MySQL proxy or DBSlayer. However, the former is in Alpha and the latter has limited documentation.
  2. Using a Ruby-based gem/plugin, such as Octopus to achieve RW-splitting in the framework.

If we wanted to go with a master-slave setup, what you recommend moving forward?

The other thought I've had was to use a master-master configuration, but am unsure about the implementation of such a setup.

Thoughts?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about replication