gpt4 book ai didi

mysql - Galera 集群有太多连接问题

转载 作者:行者123 更新时间:2023-11-28 23:12:14 56 4
gpt4 key购买 nike

当我运行一个命令来查看我们的数据库变量时:

显示状态如“%onn%”

我发现2 人连接的连接太多了:

MariaDB [(none)]> show status like "%onn%";
+-----------------------------------------------+-------+
| Variable_name | Value |
+-----------------------------------------------+-------+
| Aborted_connects | 0 |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 56711 |
| Max_used_connections | 11 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Slave_connections | 0 |
| Slaves_connected | 0 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 5 |
| wsrep_connected | ON |
+-----------------------------------------------+-------+
17 rows in set (0.00 sec)

连接数没有下降。它不断增加。

CPU Utilization (Percent): 0.82%
KiB Mem : 4045012 total, 1625720 free, 718928 used

如何诊断此问题以找到根本原因?

它崩溃了,我怀疑它可能会再次崩溃。

更新:根据这个MySQL show status - active or total connections? , Threads_connected 是我应该寻找开放连接的值。呸!太棒了!

但是,我的 processlist 可能非常可疑。注意到 Time 列了吗?他们应该那么高吗?

MariaDB [(none)]> SHOW FULL processlist;
+------+---------------+-----------------+------------+---------+-------+-------------------------+-----------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+------+---------------+-----------------+------------+---------+-------+-------------------------+-----------------------+----------+
| 1 | system user | | NULL | Sleep | 23321 | wsrep aborter idle | NULL | 0.000 |
| 2 | system user | | NULL | Sleep | 3955 | committed 3040010 | NULL | 0.000 |
| 5 | system user | | NULL | Daemon | NULL | | NULL | 0.000 |
| 6 | system user | | NULL | Daemon | NULL | | NULL | 0.000 |
| 3 | system user | | NULL | Daemon | NULL | | NULL | 0.000 |
| 4 | system user | | NULL | Daemon | NULL | | NULL | 0.000 |
| 7 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 |
| 9 | system user | | NULL | Sleep | 3957 | committed 3040009 | NULL | 0.000 |
| 10 | system user | | NULL | Sleep | 3950 | committed 3040033 | NULL | 0.000 |
| 11 | system user | | NULL | Sleep | 3954 | committed 3040022 | NULL | 0.000 |
| 12 | system user | | NULL | Sleep | 3954 | committed 3040020 | NULL | 0.000 |
| 16 | system user | | NULL | Sleep | 3953 | committed 3040030 | NULL | 0.000 |
| 17 | system user | | NULL | Sleep | 3949 | committed 3040034 | NULL | 0.000 |
| 15 | system user | | NULL | Sleep | 3953 | committed 3040031 | NULL | 0.000 |
| 9670 | xxx | localhost:51574 | tabl_name | Sleep | 4 | | NULL | 0.000 |
| 9671 | xxx | localhost:51576 | NULL | Sleep | 53 | | NULL | 0.000 |
| 9939 | xxx | localhost | NULL | Sleep | 123 | | NULL | 0.000 |
| 9942 | xxx | localhost | NULL | Query | 0 | init | SHOW FULL processlist | 0.000 |
+------+---------------+-----------------+------------+---------+-------+-------------------------+-----------------------+----------+
18 rows in set (0.00 sec)

最佳答案

不慌不忙。 Connections 是一个计数器。这些是更有趣的 Connections/UptimeThreads_running。请注意,Max_used_connections 仅为 11。没关系。

请提供* 内存大小* 显示变量;* SHOW GLOBAL STATUS; -- 在运行至少一天之后

你有某种形式的“连接池”吗?代理服务器?最大尺度?代理?也许您看到的是“池化”连接,而不是真实连接。

关于mysql - Galera 集群有太多连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45469354/

56 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com