0

I'm trying to setup two database for a single Rails Application. The first one is would be the main database and the second would be there in the case the main database would crash. So, I need to manage the two databases (rake db:create, migrate...) and replicate the datas to the second one. Does anybody know how to do this ?

Aeradriel
  • 1,224
  • 14
  • 36
  • http://stackoverflow.com/questions/11656080/rake-task-to-backup-and-restore-database should be helpful. – Prakash Murthy Jan 13 '15 at 16:18
  • 1
    You should look in to how your RDBMS handles replication, and let that manage your master / backup scheme. Your rails application should not have to worry about handling the replication. – Paul Richter Jan 13 '15 at 16:24
  • 2
    It's worth noting that [Postgres](http://postgresql.org/) does this [out of the box](http://www.postgresql.org/docs/9.4/interactive/high-availability.html). – tadman Jan 13 '15 at 16:25

1 Answers1

0

You should not do that on Application Layer.

Use keepalived or Amazon RDS.

Hiroaki Machida
  • 1,060
  • 2
  • 12
  • 23