mysqldump并发 [英] mysqldump concurrency

查看:60
本文介绍了mysqldump并发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在数据库上启动mysqldump,然后用新数据创建了一个新表,该表会被转储吗?这里的并发行为是什么?

if I started mysqldump on a database, and then created a new table with new data, will this table be dumped? what's the concurrency behavior here?

推荐答案

嗯,不确定,来自

-单次交易

此选项发送开始交易SQL语句到服务器之前转储数据.仅对事务表,例如InnoDB和BDB,因为它会转储数据库处于一致状态开始发行BEGIN的时间阻止任何应用程序.

This option sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with transactional tables such as InnoDB and BDB, because then it dumps the consistent state of the database at the time when BEGIN was issued without blocking any applications.

使用此选项时,您应该请记住,只有InnoDB表以一致的状态转储.为了例如,任何MyISAM或MEMORY表使用此选项时转储可能仍然更改状态.

When using this option, you should keep in mind that only InnoDB tables are dumped in a consistent state. For example, any MyISAM or MEMORY tables dumped while using this option may still change state.

--single-transaction dump是在进行中,以确保有效的转储文件(正确的表内容和二进制日志坐标),没有其他连接应使用以下内容语句:ALTER TABLE,CREATE TABLE,删除表,重命名表,截断桌子.一致的阅读不是与这些陈述隔离,因此请使用它们放在要倾倒的桌子上的罐头导致由执行的SELECTmysqldump检索表内容以获得不正确的内容或失败.

While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents and binary log coordinates), no other connection should use the following statements: ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the SELECT that is performed by mysqldump to retrieve the table contents to obtain incorrect contents or fail.

-single-transaction选项和--lock-tables选项是相互的排他性,因为LOCK TABLES导致任何待处理的交易隐式提交.

The --single-transaction option and the --lock-tables option are mutually exclusive because LOCK TABLES causes any pending transactions to be committed implicitly.

MySQL不支持此选项集群表;结果不能是由于NDBCLUSTER存储的事实引擎仅支持READ_COMMITTED事务隔离等级.您应该始终使用NDB备份并还原.

This option is not supported for MySQL Cluster tables; the results cannot be guaranteed to be consistent due to the fact that the NDBCLUSTER storage engine supports only the READ_COMMITTED transaction isolation level. You should always use NDB backup and restore instead.

要转储大表,您应该结合-单一交易--quick选项.

To dump large tables, you should combine the --single-transaction option with --quick.

如果要备份/移动实时数据库,则应考虑

If you want to backup/move your live DB, you should consider MySQL replication

这篇关于mysqldump并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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