# How to configure db redundancy?

**URL:** <https://www.ruby-forum.com/t/how-to-configure-db-redundancy/130482>\
**Category:** Rails\
**Created:** [February 28, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/how-to-configure-db-redundancy/130482 "2008-02-28T17:15:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kusako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@kusako](https://www.ruby-forum.com/u/kusako)\
**Post date:** [February 28, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/how-to-configure-db-redundancy/130482/1 "2008-02-28T17:15:50Z")

</div>

Hi,

I have a rails application, part of which reads data from a slave. There  
is two slaves which is available for it to read from. Problem is, the  
replication occasionally stops on either of these slave.

Therefore, I would like to set up the application with a recurring rake  
task that checks if replication has stopped on the slave it currently  
uses. If so, it should switch to the other slave and begin using that  
one.

I could do this by cycling to database.yml files, and renaming them /  
rebooting the application when the replication stops. But that’s a very  
ugly solution - does anyone know a better way to do this?

Thanks  
/Markus

---

<div class="post-metadata">

**Author:** ![kusako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@kusako](https://www.ruby-forum.com/u/kusako)\
**Post date:** [February 28, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/how-to-configure-db-redundancy/130482/2 "2008-02-28T18:29:07Z")

</div>

You should have a look at mysql proxy… Should be able todo what you  
are looking for. Not using Rake but using the proxy.

[http://forge.mysql.com/wiki/MySQL\_Proxy](http://forge.mysql.com/wiki/MySQL_Proxy)
