How to do it...

On a high level, you need to install and enable semi-synchronous plugins on both the master and all slaves where you want semi-synchronous replication. You have to restart the slave IO thread to bring the changes into effect. You can adjust the value of rpl_semi_sync_master_timeout according to your network and application. A value of 1 second is a good start:

  1. On the master, install the rpl_semi_sync_master plugin:
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';Query OK, 0 rows affected (0.86 sec)

Verify that the plugin is activated:

mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%semi%';+----------------------+---------------+| PLUGIN_NAME | PLUGIN_STATUS ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.