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