标签:
[mysql@db2 ~]$ mysqldump -A --master-data=2 > master2.sql
[mysql@db2 ~]$ mysqldump -A --dump-slave=2 > slave2.sql
[mysql@db2 ~]$ mysqldump -A --master-data=1 > master1.sql
[mysql@db2 ~]$ mysqldump -A --dump-slave=1 > slave1.sql
[mysql@db2 ~]$ diff master2.sql master1.sql 22c22 < -- CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin2.000001‘, MASTER_LOG_POS=259; --- > CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin2.000001‘, MASTER_LOG_POS=335; 845c845 < -- Dump completed on 2012-03-13 18:09:46 --- > -- Dump completed on 2012-03-13 18:10:17
[mysql@db2 ~]$ diff slave2.sql slave1.sql 22c22 < -- CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin.000007‘, MASTER_LOG_POS=107; --- > CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin.000007‘, MASTER_LOG_POS=107; 845c845 < -- Dump completed on 2012-03-13 18:09:59 --- > -- Dump completed on 2012-03-13 18:10:24
这个不但可以用于建立slave,还可用于备份中,用于读binlog进行roll forward的起点
注意:
--master-data, It turns on --lock-all-tables, unless single-transaction also is specified
mysqldump中master-data和dump-slave的区别
标签:
原文地址:http://www.cnblogs.com/zengkefu/p/5690131.html