MySQL 5.7中的半同步复制
By admin
- One minute read - 54 words在5.7下半同步是以插件的形式出现的,所以在启用半同步前要先安装半同步插件 semisync_master.so
On the master:
INSTALL PLUGIN rpl_remi_sync_master SONAME 'semisync_master.so';
On slave slave:
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
在my.cnf里配置,要写在mysqld段
master:
[mysqld]
repl_semi_sync_master_enable=1
repl_semi_sync_master_timeout=1000 #1 second
slave:
[mysqld]
repl_semi_sync_slave_enable=1
卸载插件:
uninstall plugin rpl_semi_sync_master; # master
uninstall plugin rpl_semi_sync_slave; # slave
在主上设置slave的数量,用来接受slave返回的次数数量2,用来分析 show global variables like ‘%semi%’;
set global rpl_semi_sync_master_wait_for_slave_count=2;
监控:
show global status like 'rpl_semi_sync%';