# Advice for quick fire DB replication with Rails

**URL:** <https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705>\
**Category:** Rails\
**Created:** [June 7, 2009, 12:19pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705 "2009-06-07T12:19:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yitzhakbg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e274bd/32.png) [@yitzhakbg](https://www.ruby-forum.com/u/yitzhakbg)\
**Post date:** [June 7, 2009, 12:19pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705/1 "2009-06-07T12:19:30Z")

</div>

We need an “out-of-the-box” sure-fire DB replication setup with  
automatic failover for our Rails app. We haven’t done it before. We’d  
appreciate advice on what the simplest, surest, quickest method would  
be (no more that one master/slave necessary, or two masters working  
master/master).  
Which gems? Which DB recommended?  
Thanks

---

<div class="post-metadata">

**Author:** ![yitzhakbg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e274bd/32.png) [@yitzhakbg](https://www.ruby-forum.com/u/yitzhakbg)\
**Post date:** [June 7, 2009, 2:00pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705/2 "2009-06-07T14:00:14Z")

</div>

Yitzhak Bar G. wrote:

> We need an “out-of-the-box” sure-fire DB replication setup with  
> automatic failover for our Rails app. We haven’t done it before. We’d  
> appreciate advice on what the simplest, surest, quickest method would  
> be (no more that one master/slave necessary, or two masters working  
> master/master).

I consider MySQL the easiest for such a setup, in spite of all its  
quirks. Combine it with Heartbeat or CARP and you’ll have a high  
availability configuration.

If you’d really like it to be out-of-the-box, I’d like to chime in with  
[http://en.railscluster.nl](http://en.railscluster.nl) where we’ve got this entire setup managed and  
ready to go for you.

–  
Roderick van Domburg  
[http://www.railscluster.nl](http://www.railscluster.nl)

---

<div class="post-metadata">

**Author:** ![yitzhakbg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e274bd/32.png) [@yitzhakbg](https://www.ruby-forum.com/u/yitzhakbg)\
**Post date:** [June 7, 2009, 3:40pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705/3 "2009-06-07T15:40:10Z")

</div>

As nice as that sounds, it might not fly for two reasons:

1. Security: We probably won’t be authorized to place the app on the  
Internet. Until now, it’s all privately hosted on closed connections  
(perhaps if we could establish a closed connection…)
2. Latency. We’re in Israel and the servers are in Europe.

Nonetheless, I’ll ask my boss. Maybe…

Let’s say we had to go it on our own, could you or anyone else  
recommend the quicky recipe I’m seeking?

Thanks,  
Yitzhak Bar G.  
[http://www.nite.org.il/scripts/english/default.asp](http://www.nite.org.il/scripts/english/default.asp)  
P.S. That’s our public site. As per today, the actual tests are  
administered off-line.

On Jun 7, 3:00 pm, Roderick van Domburg \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![yitzhakbg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e274bd/32.png) [@yitzhakbg](https://www.ruby-forum.com/u/yitzhakbg)\
**Post date:** [June 7, 2009, 7:10pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705/4 "2009-06-07T19:10:53Z")

</div>

Thanks

On Jun 7, 7:03 pm, Roderick van Domburg \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![yitzhakbg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/e274bd/32.png) [@yitzhakbg](https://www.ruby-forum.com/u/yitzhakbg)\
**Post date:** [June 7, 2009, 6:03pm UTC](https://www.ruby-forum.com/t/advice-for-quick-fire-db-replication-with-rails/169705/5 "2009-06-07T18:03:00Z")

</div>

Yitzhak Bar G. wrote:

> Let’s say we had to go it on our own, could you or anyone else  
> recommend the quicky recipe I’m seeking?

Doing a Google search for “mysql heartbeat” should yield some candidate  
results.  
Generally:

1. Set up a master/master MySQL configuration on two nodes as usual.  
Let one node use even numbers for autoincrements, the other one odd  
numbers.

2. Set up Heartbeat to float a single IP address between the two nodes.

3. Have the Rails application connect to the floating IP address.

–  
Roderick van Domburg  
[http://en.railscluster.nl](http://en.railscluster.nl)
