[[email protected] ~]$ mysqldump-A--master-data=2 > Master2.sql
[[email protected] ~]$ mysqldump-A--dump-slave=2 > Slave2.sql
[[email protected] ~]$ mysqldump-A--master-data=1 > Master1.sql
[[email protected] ~]$ mysqldump-A--dump-slave=1 > Slave1.sql
[[email protected] ~]$ diff Master2.sql Master1.sql22c22< --Change MASTER to master_log_file= ' mysql-bin2.000001 ', master_log_pos=259;--->Change MASTER toMaster_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
[[email protected] ~]$ diff Slave2.sql Slave1.sql22c22< --Change MASTER to master_log_file= ' mysql-bin.000007 ', master_log_pos=107;--->Change MASTER toMaster_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
There are:
A. The difference between a. = 1 and =2 is obvious, just the difference between automatic execution and manual execution
B.--master-data is used to dump data on the master end for establishing slave
--dump-slave users dump data at slave end, build a new slave, at least 2nd slave, which is already a-->b, now export data from B to build a-->c copy
This can be used not only for building slave, but also for backup, for reading Binlog The starting point of roll forward
Attention:
--master-data, It turns on--lock-all-tables, unless Single-transaction also is specified
The difference between Master-data and Dump-slave in mysqldump