Mysql5.7半同步複製
0.系統版本
mysql> select version(); +------------+ | version() | +------------+ | 5.7.25-log | +------------+ 1 row in set (0.00 sec)
-
在主上安裝和開啟
mysql> install plugin rpl_semi_sync_master soname 'semisync_master.so'; Query OK, 0 rows affected (0.03 sec) set global rpl_semi_sync_master_enabled=on;
2.在從上安裝和開啟
mysql> install plugin rpl_semi_sync_slave soname 'semisync_slave.so'; Query OK, 0 rows affected (0.01 sec) mysql> set global rpl_semi_sync_slave_enabled=on; Query OK, 0 rows affected (0.00 sec)
3.確認是否安裝成功
mysql> show variables like '%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_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)
4.用另一個方法確認是否安裝成功
mysql> show plugins; +----------------------------+----------+--------------------+----------------------+---------+ | Name | Status | Type | Library | License | +----------------------------+----------+--------------------+----------------------+---------+ | binlog | ACTIVE | STORAGE ENGINE | NULL | GPL | | mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL | | sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL | | CSV | ACTIVE | STORAGE ENGINE | NULL | GPL | | MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL | | InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL | | INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL | | ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL | | BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL | | FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL | | partition | ACTIVE | STORAGE ENGINE | NULL | GPL | | ngram | ACTIVE | FTPARSER | NULL | GPL | | validate_password | ACTIVE | VALIDATE PASSWORD | validate_password.so | GPL | | rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL | +----------------------------+----------+--------------------+----------------------+---------+ 46 rows in set (0.00 sec)
5.引數解釋:
rpl_semi_sync_master_enabled ##設定為on表示開啟了半同步功能 rpl_semi_sync_master_timeout ##單位是毫秒,表示如果主庫等待從庫回覆訊息的時間超過該值,就自動切換為非同步複製模式 rpl_semi_sync_master_wait_for_slave_count ##它控制主庫接收多少個從庫寫事物成功反饋,才返回成功給客戶端 rpl_semi_sync_master_wait_point ##預設值是AFTER_SYNC,含義是主庫將每個事物寫入binlog,並傳遞給從庫,重新整理到中繼日誌, 主庫開始等待從庫的反饋,接收到從庫的回覆之後,再提交事物並且返回“commit ok”結果給客戶端
6.重啟從庫的io執行緒讓設定生效
stop slave io_thread;
start slave io_thread;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2583936/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL5.7主從複製-半同步複製搭建MySql
- MySQL5.7半同步複製報錯案例分析MySql
- #MySQL# mysql5.7新特性之半同步複製MySql
- MySQL 半同步複製MySql
- MySQL半同步複製MySql
- MySQL的非同步複製和半同步複製MySql非同步
- 【MySQL】半同步與增強半同步複製MySql
- MySQL 8 複製(二)——半同步複製MySql
- mysql 5.7半同步複製MySql
- MySQL的半同步複製MySql
- MySQL主從複製之半同步複製MySql
- MySQL主從複製、半同步複製和主主複製MySql
- MySQL主從複製、半同步複製和主主複製概述MySql
- mysql半同步複製的設定MySql
- MySQL 半同步複製+MMM架構MySql架構
- MySQL半同步複製--after_rollbackMySql
- mysql5.5半同步複製探究MySql
- MySQL的主從複製、半同步複製、主主複製詳解MySql
- 配置mysql5.5主從複製、半同步複製、主主複製MySql
- 半同步複製報錯mysql8.0.25MySql
- MySQL半同步複製--after_commitMySqlMIT
- mysql5.5.9半同步複製功能部署MySql
- mysql5.5中的半同步複製MySql
- 主從複製、雙主複製及半同步複製、以及基於SSL的複製
- Mariadb之半同步複製叢集配置
- MySQL增強(Loss-less)半同步複製MySql
- mysql線上建立半同步複製的從庫MySql
- MySQL5.5半同步複製實現原理MySql
- MySQL 5.5 Semi-sync 半同步複製測試MySql
- MySQL 5.5半同步複製的配置與監控MySql
- mysql5.7主從複製,主主複製MySql
- MySQL5.7新特性半同步複製之AFTER_SYNC/AFTER_COMMIT的過程分析和總結MySqlMIT
- MySQL 5.5 主從複製非同步、半同步以及注意事項詳解MySql非同步
- Centos7.5部署MySQL5.7基於GTID主從複製+並行複製+半同步複製+讀寫分離(ProxySQL) 環境- 運維筆記 (完整版)CentOSMySql並行運維筆記
- 多從庫時半同步複製不工作的BUG分析
- MySQL(二):主從複製結構、半同步複製、雙主複製結構、利用SSL實現安全的MySQL主從複製MySql
- MySQL 5.7半同步複製after sync和after commit詳解MySqlMIT
- [Mysql]Mysql5.7並行複製MySql並行