MySQL Master-Slave construction

Source: Internet
Author: User

The main construction steps are as follows:

1. Open Binlog, set server_id
Open the--log-bin of the main library and set the SERVER_ID
2. Main Library Authorization
--It's also best to license the main library from the library for easy switching.
To authorize a sync account from the library in the main library:
Grant Replication Slave on * * to ' repl ' @ ' from library IP ' identified by ' XX ';

3. Get data Backup, copy to the three ways from the library:
A. Turn off mysqld, full-Library cold backup
B.mysqldump--master-data--single-transaction
C.innobackupex fully prepared--slave-info
4. Get the main library Binlog point
Looking for a backup of the Slave.info file in the record
Show master status; ---cold standby.

5. The main library can continue to serve after copying
6. Modify the configuration from the library, change the server_id and the main library, set as needed
READ_ONLY--Open Read Only
Skip-slave-start--Disable auto-enable slave
7. Replace the data file from the library, if mysqldump, then the source goes in after booting

8. Booting from library mysqld

9. Execute from Library

Change MASTER to
master_host= ' main Library IP ',
Master_user= ' Repl ',
Master_password= ' XX ',
master_port= Main Library PORT,
master_log_file= ' main Library binlog log ',
master_log_pos= Main Library Binlog Point,
master_connect_retry=10;
10.start slave;
11.show slave status\g; see the following instructions for synchronization to start normally
Slave_io_running:yes
Slave_sql_running:yes
Each show porcesslist on the master and slave;

12. Main Library import Sakila and Employees db test master-Slave synchronization situation

MySQL Master-Slave construction

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.