1.备份生产数据库:
mysqldump -uroot -p'1234567' -R --single-transaction --master-data=2 quartz>quartz.sql
mysqldump -uroot -p'1234567' -R --single-transaction --master-data=2 zjzc>zjzc.sql
--master-data 参数:
Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master. It causes the dump output to include a CHANGE MASTER
TO statement that indicates the binary log coordinates (file name and position) of the dumped server. These are the master server coordinates from which the slave should start replicating.
If the option value is 2, the CHANGE MASTER TO statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded. If the option value is 1, the
statement takes effect when the dump file is reloaded. If the option value is not specified, the default value is 1.
使用这个选项来dump 一个master的复制server 来产生一个dump文件,用于创建另一个slave server. 它使dump调用一个
CHANGE MASTER TO 语句来表明binary log 记录的位置(file name 和position) 这些是master server 记录 slvae开始复制的起点
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB