重新启动 MySQL 服务器而不中断用户
在繁忙的网站上重新启动 MySQL 服务器而不中断当前用户的一些普遍接受的策略是什么?我正在使用 LAMP 设置。如果需要的话,我不介意暂时关闭该网站,但如果某些用户活动被中断,我可能会得到损坏的数据。如果这有助于过渡,我确实有能力启动第二台服务器。我需要一个不会导致数据损坏/数据丢失的解决方案。
我怀疑这可能是一个常见问题,没有简单的解决方案,但不确定最好的方法是什么。任何指导将不胜感激。
谢谢,布莱恩
What are some generally accepted strategies for restarting a MySQL server on a busy website without interrupting current users? I am using a LAMP setup. I don't mind taking down the site for a time if need be, but if certain user activities are interrupted I could wind up with corrupted data. I do have the ability to bring up a second server if that helps in the transition. I need a solution that results in no corrupted data / data loss.
I suspect this could be a common problem without an easy solution, but not sure what the best approach would be. Any guidance would be appreciated.
Thanks, Brian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
任何高可用性解决方案都依赖于冗余。
如今最流行的策略是运行两个 MySQL 服务器。将两台服务器配置为双向复制。这也带来了其自身的挑战;您必须仔细管理应用程序,一次只写入一台服务器,以避免产生更新冲突。当您需要重新启动一台 MySQL 服务器时,切换您的应用程序以使用另一台 MySQL 服务器。
即使使用此配置,您也无法在不中断连接的情况下进行切换,即使中断时间很短。
另一个解决方案是 MySQL Cluster,其中两个 MySQL 服务器数据和存储是冗余的,但设置和管理起来也很复杂,需要高端硬件资源,并且以难以优化一般 SQL 查询的方式对数据进行分片。
Any solution for high availability depends on redundancy.
The most popular strategy today is to run two MySQL servers. Configure the two servers to replicate bidirectionally. This comes with its own challenges; you must manage your applications carefully to write to only one server at a time, to avoid creating update conflicts. When you need to restart one MySQL server, switch your apps to use the other MySQL server.
Even with this configuration, you can't make the switchover without interrupting connections, even if the interruption is brief.
Another solution is MySQL Cluster, in which both MySQL Servers and storage are redundant, but this is also complex to set up and manage, requires high-end hardware resources, and shards your data in ways that make it hard to optimize for general SQL queries.