From the library can be many stations, we assume a master m, a from S.
Main M profile add:
Server-id=1
Bin-log=logbin
The name is random.
Remember to restart
From the S configuration file add:
server-id=2
The configuration file is complete
In the main m client execution:
>show Master status;
Record the file and location (file,position), for example: logbin.000001 120
In from the S client execution:
>change Master to master_host= ' master's host address ', master_user= ' have sync copy access account ', master_password= ' password ', master_log_file= ' Logbin.000001 ', master_log_pos=120;
Synchronous replication permissions refer to the following: REPLICATION SLAVE.
Authorization example SQL for user account (password for pwd) connected from localhost:
>grant replication Slave on * * to ' user ' @ ' localhost ' identified by ' PWD ';
>flush privileges;
Open from S:
>start slave;
View from S Status:
>show processlist;
Complete.
Master-Slave Backup is the instruction executed by the main m machine automatically in the execution from the S machine, so if M already has a library that s does not have, the operation you do on the library will cause synchronous replication to fail. Therefore, it is recommended to use a clean MySQL instance to master from backup.
Stop from backup from S: Stop slave; clean: reset slave;
MySQL Master-slave configuration