(root@localhost) [(none)]> show variables like '%rpl_semi_sync%'; +-------------------------------------------+------------+ | 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_for_slave_count | 1 | | rpl_semi_sync_master_wait_no_slave | ON | | rpl_semi_sync_master_wait_point | AFTER_SYNC | +-------------------------------------------+------------+ 6 rows in set (0.00 sec)
(root@localhost) [(none)]> set global rpl_semi_sync_master_enabled=1; ---用于控制是否在主端启用半同步复制, Query OK, 0 rows affected (0.00 sec)
(root@localhost) [(none)]> set global rpl_semi_sync_master_timeout=3000; ---用于指导主端等待slave响应的时间,单位是毫秒,我这里设为3秒 Query OK, 0 rows affected (0.00 sec) 七,修改slave端半同步相关参数
(root@localhost) [(none)]> show variables like '%rpl_semi_sync%'; +---------------------------------+-------+ | Variable_name | Value | +---------------------------------+-------+ | rpl_semi_sync_slave_enabled | OFF | | rpl_semi_sync_slave_trace_level | 32 | +---------------------------------+-------+ 2 rows in set (0.01 sec)
(root@localhost) [(none)]> set global rpl_semi_sync_slave_enabled=1; ---用于控制是否在slave端启用半同步复制, Query OK, 0 rows affected (0.00 sec) 八,重启slave节点的io_thread线程,目的是让slave重新连接master,注册成为半同步的slave身份