问题1:Unknown system variable 'query_cache_size
应用侧反馈他们连上proxysql显示的mysql版本为5.5.30
登录管理端口
发现版本信息与后端mysql版本不匹配
修改proxysql组件的mysql-server_version参数
恢复正常
问题2:replace into造成MGR同步死锁故障处理
收到MGR同步告警信息同步故障
查看主库sql执行,发现有replace into :
竟然从库有死锁:
2021-11-22T10:47:14.225523+08:00 35 [Warning] [MY-010584] [Repl] Slave SQL for channel 'group_replication_applier': Worker 6 failed executing transaction 'da5adeb7-e2fe-11eb-9667-bc97e15783e6:2486811'; Could not execute Write_rows event on table usmscvas.t_his_ems_metedatahis_202101; Deadlock found when trying to get lock; try restarting transaction, Error_code: 1213; handler error HA_ERR_LOCK_DEADLOCK, Error_code: MY-001213
同步造成死锁,应该是MGR同步的bug了,死锁是有竞争关系了,那临时解决办法就是把多线程同步改成单线程同步:
mysql> show variables like '%parallel%';
+------------------------------+---------------+
| Variable_name | Value |
+------------------------------+---------------+
| innodb_parallel_read_threads | 4 |
| slave_parallel_type | LOGICAL_CLOCK |
| slave_parallel_workers | 8 |
+------------------------------+---------------+
3 rows in set (0.00 sec)
mysql> set global slave_parallel_workers = 1;
Query OK, 0 rows affected (0.00 sec)
重启group_replication(如果停不了就先把主库也stop group_replication一下)
stop group_replication;
start group_replication;
故障排除,同步恢复。
问题3:收到应用侧通知,数据库偶尔不可用
查看proxysql日志,发现有如下ERROR:
2022-04-19 12:39:26 MySQL_Monitor.cpp:1242:monitor_group_replication_thread(): [ERROR] Timeout on group replication health check for 132.xx.xxx.xx:3309 after 801ms. If the server is overload, increase mysql-monitor_groupreplication_healthcheck_timeout. Assuming viable_candidate=nO and read_only=YES
意思是心跳检测超时,proxysql会任务后端数据库不用给下线掉,如果是因为负载过大建议增加mysql-monitor_groupreplication_healthcheck_timeout参数的值
经查参数mysql-monitor_groupreplication_healthcheck_timeout默认值为800 单位毫秒,根据提示把这个值改成了10000(10秒)
mysql -uadmin -ppassword -h127.0.0.1 -P6132
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 307
Server version: 8.0.22 (ProxySQL Admin Module)
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> show variables like '%mysql-monitor_groupreplication_healthcheck_timeout%';
+----------------------------------------------------+-------+
| Variable_name | Value |
+----------------------------------------------------+-------+
| mysql-monitor_groupreplication_healthcheck_timeout | 800 |
+----------------------------------------------------+-------+
1 row in set (0.00 sec)
MySQL [(none)]> set mysql-monitor_groupreplication_healthcheck_timeout=1000;
Query OK, 1 row affected (0.00 sec)
MySQL [(none)]> load mysql variables to runtime;
Query OK, 0 rows affected (0.00 sec)
MySQL [(none)]> save mysql variables to disk;
Query OK, 137 rows affected (0.00 sec)
问题解决