本帖最后由 wxy0327 于 2012-11-17 08:15 编辑
先谢谢楼上的回复,原理都对,但并没有回答我的问题。我就是想知道,在一个应用中既使用了myisam表又使用了innodb表,使用mysqldump得到一个同时保证myisam和innodb一致性的逻辑导出,这个怎么写。换句话说,lock-all-table能否确保innodb的一致性。其次指出一点与楼上不同的理解:“它的含义是在备份结束后会结束当前的binlog,生成一个新的binlog”,而mysql手册中的描述是:
?--flush-logs, -F
Flush the MySQL server log files before starting the dump. This option requires the RELOAD privilege. If you use this option in combination with the --all-databases option, the logs are flushed for each database dumped. The exception is when using --lock-all-tables or --master-data: In this case, the logs are flushed only once, corresponding to the moment that all tables are locked. If you want your dump and the log flush to happen at exactly the same moment, you should use --flush-logs together with either --lock-all-tables or --master-data.
写的是在dump前flush log,这也正是我的问题:在自己写脚本的时候,是flush tables with read lock;flush logs;cp.....;unlock table;还是flush tables with read lock;cp......;flush logs;unlock table;还是两者一样没有区别呢?楼上同样没有回答。还是用实际可行的代码更有说服力。 |