定期制作 Live MySQL 数据库的副本
我遇到了一个问题。我正在开发一个后台项目,该项目需要访问我们网站的实时数据库,该数据库非常大且复杂。现在,当我将后台与实时 Mysql 数据库连接并运行查询时,也会出现一些缓慢的查询,这反过来会在该时间段内锁定数据库,并且实时网站会变慢。
有人建议我定期制作实时数据库的副本,并将复制的数据库与我的后台应用程序一起使用。但我也看到,在一台服务器上,如果 PHP Myadmin 上有 2 个数据库,并且一个数据库上已经运行了一个缓慢的查询,则服务器上的 CPU 使用率相当高,我认为即使我使用复制的数据库对于后台,它仍然会阻止查询并使后台或实时网站变慢。
关于如何实现一个不影响应用程序的一致性和速度的良好解决方案的任何想法。任何好的逐步程序将不胜感激。
谢谢
I am stuck with a problem. I am working on a backoffice project which needs to access the live database of our website which is very big and complicated. Now when i connect my backoffice with live Mysql database and run my queries, some slow queries are also there which in turn locks the database for that time period and the live website becomes slow.
Somebody suggested me to make a copy of the live database periodically and use the copied database with my backoffice app. But i have also seen that on one server, if you have 2 databases on PHP Myadmin, and there is a slow query already running on one database, the CPU usage is pretty high on the server and i think even if i use the copied database for backoffice, it will still block the queries and make either backoffice or live website slow.
Any ideas on how i can implement a good solution which does not affect consistency and speed of the applications. Any nice step by step procedure will be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可能想看看 mysql 复制,这里有更多描述
http: //dev.mysql.com/doc/refman/5.0/en/replication.html
基本上,您将实时(主)数据库复制到另一个可用于开发的盒子。
you might want to look at mysql replication, a litte more is described here
http://dev.mysql.com/doc/refman/5.0/en/replication.html
basically you replicate your live (master) database to another box that you can use to develop.
以下链接描述了基于约翰建议的想法:http://www.howtoforge.com/back_up_mysql_dbs_without_interruptions
Here is a link that describes the idea based on john's suggestion: http://www.howtoforge.com/back_up_mysql_dbs_without_interruptions