背景
通过用 go-mysql 同步到es过程中,提示如下错误
master does not support semi synchronous replication, use no semi-sync
解决
1.安装插件
mysql> show variables like '%semi%';
Empty set
mysql> select version();
+-------------------------+
| version() |
+-------------------------+
| 5.7.30-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
Query OK, 0 rows affected
mysql> INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
Query OK, 0 rows affected
mysql> select version();
+-------------------------+
| version() |
+-------------------------+
| 5.7.30-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set
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 |
| rpl_semi_sync_slave_enabled | OFF |
| rpl_semi_sync_slave_trace_level | 32 |
+-------------------------------------------+------------+
8 rows in set
mysql> set global rpl_semi_sync_master_enabled=1;
Query OK, 0 rows affected
mysql> set global rpl_semi_sync_master_timeout=30000;
Query OK, 0 rows affected
mysql> show variables like '%semi%';
+-------------------------------------------+------------+
| Variable_name | Value |
+-------------------------------------------+------------+
| rpl_semi_sync_master_enabled | ON |
| rpl_semi_sync_master_timeout | 30000 |
| 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 |
| rpl_semi_sync_slave_enabled | OFF |
| rpl_semi_sync_slave_trace_level | 32 |
+-------------------------------------------+------------+
8 rows in set
mysql>
2. 修改配置文件并重启
root@base2018:/etc/mysql# vim mysql.conf.d/mysqld.cnf
# 开启半同步
rpl_semi_sync_slave_enabled =1
rpl_semi_sync_master_enabled =1
#开启binlog
server_id=1
log_bin = mysql-bin
binlog_format = ROW
expire_logs_days = 30
log-bin = /var/log/mysql/mysql-bin.log
root@base2018:/etc/mysql# service mysql start
其他关于binlog
- 通过
show binlog events\G;
可以可视化bing log内容.(可以加很多查询参数)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。