mysql 5.7半同步複製
先搭建完非同步複製後,再進行配置半同步複製。
在主庫安裝半同步外掛:
> install plugin rpl_semi_sync_master soname 'semisync_master.so'; Query OK, 0 rows affected (0.06 sec) mysql> set global rpl_semi_sync_master_enabled=on; Query OK, 0 rows affected (0.01 sec) mysql> set global rpl_semi_sync_master_timeout=30000; Query OK, 0 rows affected (0.00 sec)
以上引數也一併寫入my.cnf
在從庫也安裝半同步外掛:
> install plugin rpl_semi_sync_slave soname 'semisync_slave.so'; Query OK, 0 rows affected (0.03 sec) mysql> set global rpl_semi_sync_slave_enabled=on; Query OK, 0 rows affected (0.00 sec)
別忘了將引數寫入my.cnf。
接下來要開啟半同步複製。在這之前,先在主庫上看看未開啟半同步複製時主庫的狀態:
mysql> show status like '%semi_sync%'; +--------------------------------------------+-------+ | Variable_name | Value | +--------------------------------------------+-------+ | Rpl_semi_sync_master_clients | 0 | | Rpl_semi_sync_master_net_avg_wait_time | 0 | | Rpl_semi_sync_master_net_wait_time | 0 | | Rpl_semi_sync_master_net_waits | 0 | | Rpl_semi_sync_master_no_times | 0 | | 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 | 0 | | Rpl_semi_sync_master_tx_wait_time | 0 | | Rpl_semi_sync_master_tx_waits | 0 | | Rpl_semi_sync_master_wait_pos_backtraverse | 0 | | Rpl_semi_sync_master_wait_sessions | 0 | | Rpl_semi_sync_master_yes_tx | 0 | +--------------------------------------------+-------+ 14 rows in set (0.04 sec)
第一行的rpl_semi_sync_master_clients是0。
在slave庫重啟slave執行緒以開啟半同步複製。
mysql> stop slave io_thread; Query OK, 0 rows affected (0.00 sec) mysql> start slave io_thread; Query OK, 0 rows affected (0.00 sec)
此時,再檢視主庫的狀態:
mysql> show status like '%semi_sync%'; +--------------------------------------------+-------+ | Variable_name | Value | +--------------------------------------------+-------+ | Rpl_semi_sync_master_clients | 1 | | Rpl_semi_sync_master_net_avg_wait_time | 0 | | Rpl_semi_sync_master_net_wait_time | 0 | | Rpl_semi_sync_master_net_waits | 0 | | Rpl_semi_sync_master_no_times | 0 | | 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 | 0 | | Rpl_semi_sync_master_tx_wait_time | 0 | | Rpl_semi_sync_master_tx_waits | 0 | | Rpl_semi_sync_master_wait_pos_backtraverse | 0 | | Rpl_semi_sync_master_wait_sessions | 0 | | Rpl_semi_sync_master_yes_tx | 0 | +--------------------------------------------+-------+
rpl_semi_sync_master_clients變為1。
而此時的從庫狀態:
mysql> show global status like '%semi%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | Rpl_semi_sync_slave_status | ON | +----------------------------+-------+
完成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22621861/viewspace-2753047/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql5.7半同步複製MySql
- MySQL5.7主從複製-半同步複製搭建MySql
- #MySQL# mysql5.7新特性之半同步複製MySql
- MySQL5.7半同步複製報錯案例分析MySql
- MySQL 半同步複製MySql
- MySQL半同步複製MySql
- MySQL的半同步複製MySql
- MySQL的非同步複製和半同步複製MySql非同步
- 【MySQL】半同步與增強半同步複製MySql
- MySQL 8 複製(二)——半同步複製MySql
- MySQL 5.7半同步複製after sync和after commit詳解MySqlMIT
- MySQL主從複製之半同步複製MySql
- mysql半同步複製的設定MySql
- MySQL 半同步複製+MMM架構MySql架構
- MySQL半同步複製--after_rollbackMySql
- mysql5.5半同步複製探究MySql
- MySQL主從複製、半同步複製和主主複製MySql
- MySQL 5.7半同步機制MySql
- MySQL主從複製、半同步複製和主主複製概述MySql
- 半同步複製報錯mysql8.0.25MySql
- MySQL半同步複製--after_commitMySqlMIT
- mysql5.5.9半同步複製功能部署MySql
- mysql5.5中的半同步複製MySql
- MySQL的主從複製、半同步複製、主主複製詳解MySql
- 配置mysql5.5主從複製、半同步複製、主主複製MySql
- MySQL增強(Loss-less)半同步複製MySql
- mysql線上建立半同步複製的從庫MySql
- MySQL5.5半同步複製實現原理MySql
- MySQL 5.5 Semi-sync 半同步複製測試MySql
- MySQL 5.5半同步複製的配置與監控MySql
- MySQL 5.7 多主一從(多源複製)同步配置MySql
- MySQL 5.7並行複製MySql並行
- mysql 5.7多源複製MySql
- MySQL 5.7 並行複製MySql並行
- MySQL 5.7的安裝及主從複製(主從同步)MySql主從同步
- [Mysql]Mysql5.7並行複製MySql並行
- 【Mysql】mysql5.7無損複製MySql
- mysql5.7主從複製,主主複製MySql