Master/slave database manual synchronization of master-data

Source: Internet
Author: User

The master-data parameter for manual synchronization of master/slave databases is often used when a slave database is created, because this is a relatively useful parameter, the default value is 1, by default, the statement contains change master to, which contains the start position of the file and position records. When the master-data = 2, The mysqldump file contains the change master to Statement, which is in the commented state and dump the file.

[Root @ aeolus1 c_learn] # mysqldump-uroot test -- single-transaction -- master-data = 2> the master-data. SQL filters out the change master to information [root @ aeolus1 c_learn] # grep-I" change master to "master-data. SQL -- CHANGE MASTER TO MASTER_LOG_FILE = 'mysql-bin.000012 ', MASTER_LOG_POS = 107;

 

Then modify
change master to  master_host='xx.xx.xx.xx',master_user='repl',master_password='repl',master_port=3306,master_log_file='mysql-bin.000012',master_log_pos=107;

 

Then run the slave command from the database.
mysql> change master to  master_host='xx.xx.xx.xx',master_user='repl',master_password='repl',master_port=3306,master_log_file='mysql-bin.000012',master_log_pos=107;

 

Then
mysql>start slave 

 

Execute again
mysql>show slave status;

 

Note: If you have configured the server connection and password before, the slave server does not need to reset slave, directly
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000012', MASTER_LOG_POS=107;
You can.

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.