# Master/Slave database setup with Rails?

**URL:** <https://discuss.rubyonrails.org/t/master-slave-database-setup-with-rails/45266>\
**Category:** rubyonrails-talk\
**Created:** [August 18, 2009, 6:43pm UTC](https://discuss.rubyonrails.org/t/master-slave-database-setup-with-rails/45266 "2009-08-18T18:43:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Hallstrom](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@Philip\_Hallstrom](https://discuss.rubyonrails.org/u/Philip_Hallstrom)\
**Post date:** [August 18, 2009, 6:43pm UTC](https://discuss.rubyonrails.org/t/master-slave-database-setup-with-rails/45266/1 "2009-08-18T18:43:08Z")

</div>

> I currently setting up a master slave configuration with MySQL where I will have 1 master for reads/writes and a slave for reads. Just looking around, I see the Masochism plugin was written for this. Has anyone used this and does it work well in a production environment with high traffic? Are there any better solutions? Thanks!

I haven't used that one, but we used another one (mysql\_replication\_adapter I think it was). That one worked well. Where we used that one I heard they switched over to this one and love it. The site is huge too so meets your criteria.

-philip

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@Mauricio\_Linhares](https://discuss.rubyonrails.org/u/Mauricio_Linhares)\
**Post date:** [August 19, 2009, 8:26pm UTC](https://discuss.rubyonrails.org/t/master-slave-database-setup-with-rails/45266/2 "2009-08-19T20:26:49Z")

</div>

[http://github.com/mauricio/master\_slave\_adapter/tree/master](http://github.com/mauricio/master_slave_adapter/tree/master)

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://avatars.discourse-cdn.com/v4/letter/m/b5a626/32.png) [@Mauricio\_Linhares](https://discuss.rubyonrails.org/u/Mauricio_Linhares)\
**Post date:** [August 20, 2009, 2:06pm UTC](https://discuss.rubyonrails.org/t/master-slave-database-setup-with-rails/45266/3 "2009-08-20T14:06:34Z")

</div>

My woes were a little bit like yours, Masochism broke badly with the then current rails (2.2) and I had to find a solution. None were available so I just took the simplest solution (that should have been the only solution...) that was a "fake" db adapter that handled the calls to a master/slave connection as needed.

Shout if you have any troubles using it.
