Introduced:
mysql traditional master-slave replication is asynchronous replication mode, the master server to send Binlog to the slave server, it is considered to be completed synchronously.
MySQL semi-synchronous replication mode ensures that the binlog log file sent by the primary server is received from the server and written to its own trunk log relay log , and then a feedback is given to the master server, Tell the other party that it has been received. The main library thread is then returned to the current session to tell the operation to complete. When a time-out occurs, the source master temporarily switches to asynchronous replication mode until at least one of the slave servers set to semi-synchronous mode receives the information in a timely manner.
Configuration:
1: First configure the master-slave synchronization.
2: in the master-slave library, respectively Mounting Plug pieces, open Semi_sync .
Master
Sql>install plugin rpl_semi_sync_master soname ' semisync_master.so ';
Sql>set global rpl_semi_sync_master_enabled = on;
Slave
Sql>install plugin rpl_semi_sync_slave soname ' semisync_slave.so ';
Sql>set global rpl_semi_sync_slave_enabled = on;
Restart master-slave replication;
Sql>stop slave;
Sql>start slave;
You can also add the following configuration to the configuration file for the configuration to take effect :
# VI my.cnf
rpl_semi_sync_master_enabled = 1
Or
rpl_semi_sync_slave_enabled = 1
Check the semi-synchronous replication status:
Main Library:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/A2/wKiom1WjcWfRbh5VAAKJaUjR1ws450.jpg "title=" 1.jpg " alt= "Wkiom1wjcwfrbh5vaakjaujr1ws450.jpg"/>
rpl_semi_sync_master_enabled to be on , indicating Semi_sync has been turned on.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/A2/wKiom1WjcXeQPm-ZAAOoLoeD4dc340.jpg "title=" 2.jpg " alt= "Wkiom1wjcxeqpm-zaaooloed4dc340.jpg"/>
rpl_semi_sync_master_status for on indicates that the semi-synchronous mechanism on the main library is functioning properly and is running.
Rpl_semi_sync_master_clients indicates the number of slave libraries currently connected to the main library in semi-synchronous mode.
From library:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/9F/wKioL1Wjc2DzZVdOAAIE_eaw-MU729.jpg "title=" 3.jpg " alt= "Wkiol1wjc2dzzvdoaaie_eaw-mu729.jpg"/>
rpl_semi_sync_slave_enabled to be on description from the library Semi_sync function is turned on.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/A2/wKiom1WjcZmCtOymAADvOnh-Hvc393.jpg "title=" 4.jpg " alt= "Wkiom1wjczmctoymaadvonh-hvc393.jpg"/>
rpl_semi_sync_slave_status for on indicates that the semi-synchronous mechanism from the library is functioning properly and is running.
viewing from the library log, you can also see Semi_sync Related information:
Slave I/o thread:start semi-sync replication to master ' [e-mail protected]:3306 ' in log ' mysql-bin.000011 ' at position 107.
This article is from the Linux OPS blog, so be sure to keep this source http://icenycmh.blog.51cto.com/4077647/1673819
MySQL Semi-synchronous replication