ERROR 1193 (HY000): Unknown system variable ‘rpl_semi_sync_master_enabled‘
阿新 • • 發佈:2020-09-20
問題
設定半同步複製變數時報錯
mysql> set global rpl_semi_sync_master_enabled = 0;
ERROR 1193 (HY000): Unknown system variable 'rpl_semi_sync_master_enabled'
或者
mysql> set global rpl_semi_sync_slave_enabled = 0;
ERROR 1193 (HY000): Unknown system variable 'rpl_semi_sync_slave_enabled'
這是因為沒有安裝半同步外掛。
檢視plugins,沒有發現半同步複製外掛。
mysql> show plugins; +----------------------------+----------+--------------------+-----------------+---------+ | Name | Status | Type | Library | License | +----------------------------+----------+--------------------+-----------------+---------+ | keyring_file | ACTIVE | KEYRING | keyring_file.so | GPL | | 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 | ... ...
解決方案
首先,當前MySQL版本是5.7.23,已自帶半同步複製外掛安裝包。
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.7.23 |
+-----------+
1 row in set (0.00 sec)
安裝rpl_semi_sync_master plugin
mysql> install plugin rpl_semi_sync_master soname 'semisync_master.so'; Query OK, 0 rows affected (0.08 sec)
重新設定
mysql> set global rpl_semi_sync_master_enabled = 0;
Query OK, 0 rows affected (0.00 sec)
安裝rpl_semi_sync_slave plugin:
mysql> install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
Query OK, 0 rows affected (0.02 sec)
重新設定:
mysql> set global rpl_semi_sync_slave_enabled = 0;
Query OK, 0 rows affected (0.00 sec)
在主庫例項和從庫例項上,都安裝兩個半同步複製外掛。
因為如果發生主從切換,從庫會成為主庫。
檢視半同步複製相關的plugins:
mysql> SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'rpl_semi_sync_%';
+----------------------+
| PLUGIN_NAME |
+----------------------+
| rpl_semi_sync_master |
| rpl_semi_sync_slave |
+----------------------+
2 rows in set (0.00 sec)
mysql>
可以看到,有兩個半同步複製外掛。