In the 5.5 and later versions of MySQL, added a parameter--dump-slave, using this parameter, we can export the data in the slave node to establish a new slave, to avoid the pressure on the main library.
Here's how:
executed on the slave;
1. View the status of the current synchronization
# show Slave Status\g focuses on the following sections:
master_log_file:mysql-bin.000095
read_master_log_pos:50607116
relay_master_log_file:mysql-bin.000095
exec_master_log_pos:50607116
2. Then export the data on the slave as follows:
# mysqldump-uroot-proot--single-transaction--dump-slave=2-a > All.sql
3. View exported files
# head-30 All.sql can see fields similar to the following:
--Change MASTER to master_log_file= ' mysql-bin.000095 ', master_log_pos=50607116;
In this case, we take this export data, restore to a new slave, execute:
> Change MASTER to
Master_host= ' Master_ip ',
Master_user= ' Repluser ',
Master_password= ' 123456 ',
master_port=3306,
Master_log_file= ' mysql-bin.000095 ',
master_log_pos=50607116,
master_connect_retry=10;
> Start slave; You can start replication on the new slave.
Mysqldump--dump-slave