Mysqldump--dump-slave

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.