0

我正在尝试通过 proxysql 为 galera 集群设置简单的代理。后端节点和 proxysql 都在 docker 中。代理工作正常,除了监控。当我在一个节点上停止 mariadb 时,proxysql 仍然将该节点显示为 ONLINE。

我试过了:

  • 创建监控用户。这似乎工作正常。
  • 将配置加载到运行时。
  • 设置 mysql-connect_timeout_server_max=20000;
  • UPDATE mysql_servers SET max_latency_ms=30 WHERE hostname='10.77.250.25';
  • 更新 mysql_servers SET max_replication_lag=30 WHERE hostname='10.77.250.25';

proxysql 管理控制台的输出:

mysql> SELECT * FROM mysql_servers;
+--------------+--------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname     | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10           | 10.77.250.27 | 3306 | 0         | ONLINE | 1      | 0           | 100             | 0                   | 0       | 0              |         |
| 20           | 10.77.250.25 | 3306 | 0         | ONLINE | 1      | 0           | 100             | 30                  | 0       | 30             |         |
| 20           | 10.77.250.26 | 3306 | 0         | ONLINE | 1      | 0           | 100             | 0                   | 0       | 0              |         |
| 20           | 10.77.250.27 | 3306 | 0         | ONLINE | 1      | 0           | 100             | 0                   | 0       | 0              |         |
+--------------+--------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.00 sec)

mysql> select hostname,from_unixtime(time_start_us/1000000) as last_check ,ping_error as error from monitor.mysql_server_ping_log group by hostname order by time_start_us desc;
+--------------+---------------------+-------------------------------------------------------+
| hostname     | last_check          | error                                                 |
+--------------+---------------------+-------------------------------------------------------+
| 10.77.250.25 | 2021-11-18 21:01:07 | Can't connect to MySQL server on '10.77.250.25' (115) |
| 10.77.250.26 | 2021-11-18 21:01:07 | NULL                                                  |
| 10.77.250.27 | 2021-11-18 21:01:07 | NULL                                                  |
+--------------+---------------------+-------------------------------------------------------+

请帮忙!

4

1 回答 1

0

我应该查看 runtime_mysql_servers,而不是 mysql_servers。

mysql> SELECT * FROM runtime_mysql_servers;
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname     | port | gtid_port | status  | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10           | 10.77.250.27 | 3306 | 0         | ONLINE  | 1      | 0           | 100             | 0                   | 0       | 0              |         |
| 20           | 10.77.250.27 | 3306 | 0         | ONLINE  | 1      | 0           | 100             | 0                   | 0       | 0              |         |
| 20           | 10.77.250.26 | 3306 | 0         | ONLINE  | 1      | 0           | 100             | 0                   | 0       | 0              |         |
| 20           | 10.77.250.25 | 3306 | 0         | SHUNNED | 1      | 0           | 100             | 30                  | 0       | 30             |         |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.00 sec)
于 2021-11-19T04:35:04.253 回答