冷备份期间网站数据库写入的最佳实践?
假设您有一个大型、流行的数据库驱动网站。工地里整天整夜都有人。它们访问读取和写入数据库的页面。
在实施每日数据库备份计划时,涉及到进行冷备份,这意味着在备份过程中暂时关闭数据库或锁定表。这可确保在备份时不会将新数据插入数据库。
有哪些好的方法可以对站点控制器和模型进行编码,以便它们不会因表锁或数据库脱机而失败?您是否需要实现某种数据库写入队列系统或类似的系统?或者只是暂时让整个网站离线?或者只是进行实时备份而不锁定或关闭任何东西?什么是好的方法?
Lets say you have a large, popular database-driven website. There are people on the site all day and all night. They access pages that both read and write to the database.
When implementing a daily database backup plan, it involves doing cold backups, which means that you temporarily shutdown the database or lock tables while the backup is in progress. This ensures that new data is not inserted into the database while the backup is happening.
What are some good approaches to coding your site controllers and models so that they don't fail due to table locks or the database being offline? Do you need to implement some sort of database write queue system or something like that? Or just take the whole site offline temporarily? Or just do live backups without locking or shutting down anything? What is a good approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用复制,这是一个简单的场景
1主A,2从B,C
对于第 2 天,只需重复整个周期,当然 master 现在是 B。
Use replication, here is a simple scenario
1 master A, 2 slaves B, C
For Day 2, just repeat the whole cycle, of course master is now B.