开发者

Replication to a redundant server with Rails?

I'm working on a Ruby on Rails/PostgreSQL web app that a mobile device communicates with. The mobile device has the abilit开发者_运维知识库y to post to a primary server and geographically redundant secondary server at the same time. I would to replicate my user and profile data from the primary server to the secondary server instantaneously. Is ActiveResource the preferred choice for this? Is this better done at the Rails level or PostgreSQL level? I'm wide open to any ideas to make this as reliable and low maintenance as possible.

Thanks, Chirag


I'd recommend doing it at the PostgreSQL level, with something like Bucardo or Slony. If you do it at the Rails level, it will break as soon as you have a single modification made that doesn't go through rails. You may not have that today, but designing away the ability to have it in the future is very short-sighted.


You have to do the replication at MySQL level. That is, create a master database and several slaves (read-only) and have MySQL to do its work (synchronization)

For rails to work with such replicated environment, I suggest using my_replication plugin which helps switch database connection to one of the slaves at run-time

https://github.com/minhnghivn/my_replication

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜