semi-synchronous replication requires the use of plug-ins, and master and slave nodes need to install plugins. After the plug-in is installed , configure system variables to enable and disable the semi-synchronous replication feature.
1. semi-synchronous implementation Prerequisites
database version is 5.5 or higher
have_dynamic_loading system variable is YES.
replication is running correctly.
2. Installing plugins
Main node Install PLUGIN rpl_semi_sync_master SONAME ' semisync_master.so '; from node install PLUGIN rpl_semi_sync_slave SONAME ' Semisync_slave.so ';
3. see if the installation was successful
show plugins; display similar instructions for installation success | rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL | | rpl_semi_sync_slave | active | replication | semisync_slave.so | GPL | mysql> show variables like '%semi% '; +-------------------------------------------------- ------+-------+| variable_name | value |+------------------------------ ---------------------------+-------+| rpl_semi_sync_master_enabled | off | | rpl_semi_sync_master_timeout | 10000 | | rpl_semi_sync_master_trace_level | 32 | | rpl_semi_sync_master_wait_no_slave | on | | rpl_semi_sync_slave_enabled | off | | rpl_semi_sync_slave_trace_level | 32 |+-------------- -------------------------------------------+-------+6 rows in set (0.00 sec)
4. enable half-sync
Master node enables half-sync with a time-out of 10S
SET GLOBAL rpl_semi_sync_master_enabled = 1; SET GLOBAL rpl_semi_sync_master_timeout = 10000;
Enable half-sync from the node, restart the copy thread to take effect set GLOBAL rpl_semi_sync_slave_enabled = 1; STOP SLAVE Io_thread; START SLAVE Io_thread;
5. confirm that the half-sync is active
Show global status like ' rpl% ';
6. Persistent Parameters
On the master:[mysqld]rpl_semi_sync_master_enabled=1rpl_semi_sync_master_timeout=1000 # 1 secondOn each SLAVE:[MYSQLD ]rpl_semi_sync_slave_enabled=1
This article is from the "ROIDBA" blog, make sure to keep this source http://roidba.blog.51cto.com/12318731/1893359
MySQL5.6 semi-synchronous replication to ensure database consistency