proxy SQL 集群状态异常

mysql> select hostgroup_id, hostname, port,status from runtime_mysql_servers order by hostgroup_id;
+--------------+-----------------+------+--------+
| hostgroup_id | hostname        | port | status |
+--------------+-----------------+------+--------+
| 1            | 192.168.211.129 | 3306 | ONLINE |
| 2            | 192.168.211.133 | 3306 | ONLINE |
| 2            | 192.168.211.134 | 3306 | ONLINE |
+--------------+-----------------+------+--------+

上图可以看出主库缺一个2的状态;查看proxy SQL日志如下:

[root@localhost /]# tail -f /data/proxysql/proxysql.log
2024-08-13 16:41:32 [INFO] New mysql_galera_hostgroups table
2024-08-13 16:41:32 [INFO] New mysql_aws_aurora_hostgroups table
2024-08-13 16:41:32 [INFO] MySQL_HostGroups_Manager::commit() locked for 5ms
Standard Query Processor rev. 2.0.6.0805 -- Query_Processor.cpp -- Sun May 17 20:24:24 2020
In memory Standard Query Cache (SQC) rev. 1.2.0905 -- Query_Cache.cpp -- Sun May 17 20:24:24 2020
Standard MySQL Monitor (StdMyMon) rev. 2.0.1226 -- MySQL_Monitor.cpp -- Sun May 17 20:24:24 2020
2024-08-13 16:41:32 MySQL_Monitor.cpp:718:monitor_connect_thread(): [ERROR] Server 192.168.211.134:3306 is returning "Access denied" for monitoring user
2024-08-13 16:41:33 MySQL_Monitor.cpp:718:monitor_connect_thread(): [ERROR] Server 192.168.211.133:3306 is returning "Access denied" for monitoring user
2024-08-13 16:41:33 MySQL_Monitor.cpp:718:monitor_connect_thread(): [ERROR] Server 192.168.211.129:3306 is returning "Access denied" for monitoring user
2024-08-13 16:41:35 [INFO] Latest ProxySQL version available: 2.6.3-107-gcdfcfdc

解决办法如下:

先检查proxysql.cnf文件的密码和IP地址,然后执行如下命令:

[root@localhost /]# vi /etc/proxysql.cnf 
[root@localhost /]# rm -rf /var/lib/proxysql /data/proxysql
[root@localhost /]# mkdir /var/lib/proxysql /data/proxysql && chown -R proxysql:proxysql  /var/lib/proxysql /data/proxysql
[root@localhost /]# vi /data/proxysql.cnf 
[root@localhost /]# cd data/
[root@localhost data]# \cp -rf proxysql.cnf /etc/proxysql.cnf
[root@localhost data]# systemctl restart proxysql 

完美解决如下

[root@localhost data]# mysql -uadmin -padmin -h127.0.0.1 -P6032
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.12 (ProxySQL Admin Module)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select hostgroup_id, hostname, port,status from runtime_mysql_servers order by hostgroup_id;
+--------------+-----------------+------+--------+
| hostgroup_id | hostname        | port | status |
+--------------+-----------------+------+--------+
| 1            | 192.168.211.129 | 3306 | ONLINE |
| 2            | 192.168.211.129 | 3306 | ONLINE |
| 2            | 192.168.211.130 | 3306 | ONLINE |
| 3            | 192.168.211.128 | 3306 | ONLINE |
+--------------+-----------------+------+--------+
4 rows in set (0.04 sec)

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值