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 8 複製(二)——半同步複製MySql
- mysql 5.7半同步複製MySql
- MySQL主從複製之半同步複製MySql
- mysql半同步複製的設定MySql
- Mariadb之半同步複製叢集配置
- 半同步複製報錯mysql8.0.25MySql
- MySQL增強(Loss-less)半同步複製MySql
- mysql5.7主從複製,主主複製MySql
- [Mysql]Mysql5.7並行複製MySql並行
- MySQL5.7主從複製教程MySql
- 多從庫時半同步複製不工作的BUG分析
- MySQL 8 複製(一)——非同步複製MySql非同步
- Mysql半同步複製模式說明及配置示例 - 運維小結MySql模式運維
- MySQL主從複製之非同步複製MySql非同步
- MySQL半同步複製資料最終一致性驗證MySql
- MongoDB 重新同步複製整合員MongoDB
- 主從複製--非同步篇非同步
- GreatSQL 非同步複製及搭建SQL非同步
- MySQL案例07:MySQL5.7併發複製隱式bugMySql
- MongoDB複製集資料同步流程MongoDB
- PostgreSQL 13 同步流複製(#2.4)-202104SQL
- MySQL5.7在滴滴雲主機上的主從複製MySql
- PostgreSQL 13 非同步流複製(#2.1)-202103SQL非同步
- PostgreSQL 13 同步流複製+failover(#2.6)-202104SQLAI
- MySQL 同步複製及高可用方案總結MySql
- MongoDB原理:複製集狀態同步機制MongoDB
- PostgreSQL邏輯複製資料同步到kafkaSQLKafka
- 淺複製和深複製的概念與值複製和指標複製(引用複製)有關 淺複製 “指標複製 深複製 值複製指標
- mysql5.7 GTID 主從複製模式-增加新的slave1(好文章!!)MySql模式
- Java引用複製、淺複製、深複製Java
- MySQL 5.7 多主一從(多源複製)同步配置MySql
- MySQL-主從複製之同步主從資料MySql
- mysql同步(複製)延遲的原因及解決方案MySql
- PostgreSQL 13 同步流複製+延遲備庫(#2.5)-202104SQL
- PostgreSQL 13 非同步流複製+failover切換(#2.3)-202104SQL非同步AI