在实时数据库上运行mysqldump [英] Running mysqldump on live database

查看:90
本文介绍了在实时数据库上运行mysqldump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只想知道在实时数据库上运行mysqldump有什么风险?有没有数据库损坏的机会? mysqldump似乎锁定了整个数据库.

Just wanted to know what are the risks of running a mysqldump on a live database? Are there any chances of database corruption? mysqldump seems to lock the entire database.

推荐答案

您的数据库表使用什么引擎?如果您使用的是事务表,则可以使用单一交易"选项进行转储,这将以一致的状态转储您的表.如果使用的是非事务型的表,例如MyISAM,则不应有任何数据库损坏问题.但是,如果您遇到竞争情况,则可能会有不一致的数据问题.无论哪种情况,在发生转储时,您都将极大地减慢数据库响应时间.最好的选择是对从属服务器运行转储,或者在运行转储之前等待站点处于静态状态.

What engine are your database tables using? If you are using transactional tables you can dump using the option "single-transaction", which will dump your tables in a consistent state. If you are using tables like MyISAM, which are non transactional, you should not have any DB corruption issues. You may have inconsistent data problems however, if you get into a race scenario. In either case, you will be dramatically slowing down DB response time while the dump occurs. Best bet is to run the dump against a slave or to wait for the site to be quiescent before running the dump.

这篇关于在实时数据库上运行mysqldump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆