MySQL半同步复制

前言:

本文为完成,不适合阅读!!!

主:
MariaDB>INSTALL PLUGIN rpl_semi_sync_master SONAME ‘semisync_master.so’;
MariaDB>SHOW GLOBAL VARIABLES LIKE ‘rpl_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 | #无从节点是否等待
+————————————————-+———+

MariaDB>SET GLOBAL rpl_semi_sync_master_enabled=ON;
MariaDB>SHOW GLOBAL STATUS LIKE ‘%rpl%’;

从:
MariaDB>INSTALL PLUGIN rpl_semi_sync_slave SONAME ‘semisync_slave.so’;
MariaDB>SHOW GLOBAL VARIABLES LIKE ‘rpl_semi%’;
+——————————————+——–+
| Variable_name | Value |
+——————————————+——–+
| rpl_semi_sync_slave_enabled | OFF |
| rpl_semi_sync_slave_trace_level | 32 |
+——————————————+——–+
MariaDB>SHOW GLOBAL STATUS LIKE ‘%rpl%’;
MariaDB>SET GLOBAL rpl_semi_sync_slave_enabled=ON;
MariaDB>STOP SLAVE IO_THREAD; #需要重启线程才能识别新的设置
MariaDB>SHOW GLOBAL VARIABLES LIKE ‘rpl_semi%’;
MariaDB>START SLAVE IO_THREAD;

主验证:
MariaDB>CREATE TABLE CHECK1;
MariaDB>SHOW GLOBAL STATUS LIKE ‘%rpl%’;
+——————————————–+————-+
| Variable_name | Value |
+——————————————–+————-+
| Rpl_semi_sync_master_clients | 1 |
| Rpl_semi_sync_master_net_avg_wait_time | 1047 |
| Rpl_semi_sync_master_net_wait_time | 1047 |
| Rpl_semi_sync_master_net_waits | 1 |
| Rpl_semi_sync_master_no_times | 1 |
| Rpl_semi_sync_master_no_tx | 0 |
| Rpl_semi_sync_master_status | ON |
| Rpl_semi_sync_master_timefunc_failures | 0 |
| Rpl_semi_sync_master_tx_avg_wait_time | 1237 |
| Rpl_semi_sync_master_tx_wait_time | 1237 |
| Rpl_semi_sync_master_tx_waits | 1 |
| Rpl_semi_sync_master_wait_pos_backtraverse | 0 |
| Rpl_semi_sync_master_wait_sessions | 0 |
| Rpl_semi_sync_master_yes_tx | 1 |
| Rpl_status | AUTH_MASTER |
+——————————————–+————-+

你可能感兴趣的:(linux,mysql)