从服务器故障中拯救 Rails 应用

发布于 2024-11-02 21:01:40 字数 198 浏览 3 评论 0原文

我有一个 Rails 应用程序,现在托管在专用服务器上。今天发生了一些事情:应用程序没有响应,我没有 ssh 访问权限,重新启动没有帮助,我正在等待技术支持响应。但这不是问题,我只需要这个应用程序在线,即使服务器出现故障。哪个是最简单的选择?我可以在不同的主机上创建第二个服务器并在出现故障时从那里提供服务吗?如果可以,如何同步数据库和文件?应用程序负载并不重,我只需要它可用即可。

I have a rails app which is now hosted on dedicated server. Today something happened: app doesn't respond and I have no ssh access, restarting doesn't help and I am waiting for tech support to respond. But this is not a question, I just need this app to be online even if server fails. Which is the easiest option? Can I create second server on different hosting and serve from there in case of failure, if so, how to sync db and files? Application is not heavily loaded, I just need it to be available.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜宝宝 2024-11-09 21:01:40

问题很难解决。没有一种经过验证的方法可以实现这一点,但总的来说,您需要“无单点故障”。

有一门完整的科学致力于网络应用程序的可靠性——您不可能在一个如此问题中得到答案。

您可以频繁备份数据库,将它们存储在 S3(和/或其他位置)上。然后,您可以

  1. 在主机上拥有应用程序服务器的映像,
  2. 当您的服务器死机时启动它
  3. ,恢复数据库
  4. 让新的应用程序服务器接管责任(最简单的方法:假设旧服务器的 IP 地址)

Difficult problem to solve. There's no one proven way to make this happen, but in general you need "No Single Point of Failure"

There's an entire science devoted to reliability in web applications -- no way can you get that answered in a SO question.

You can take frequent backups of your database, store them on S3 (and/or somewhere else). You can then

  1. have an image of your applications server at your host
  2. spin it up when your server dies
  3. restore the database
  4. Have the new application server take over responsibility (easiest way: assume the old server's IP address)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文