【问题标题】:Galera clusters with too many connections issue具有太多连接问题的 Galera 集群
【发布时间】:2017-08-02 19:24:05
【问题描述】:

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

show status like "%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)

【问题讨论】:

    标签: mysql galera


    【解决方案1】:

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

    请提供 * 公羊大小 * SHOW VARIABLES; * SHOW GLOBAL STATUS; -- 至少运行一天后

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

    【讨论】:

      猜你喜欢
      • 2021-10-26
      • 2014-07-30
      • 2019-01-07
      • 1970-01-01
      • 2021-09-23
      • 2014-04-15
      • 2016-07-11
      • 2012-01-17
      • 1970-01-01
      相关资源
      最近更新 更多