Galera集群有太多的连接问题

时间:2017-08-02 19:24:05

标签: mysql galera

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

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)

1 个答案:

答案 0 :(得分:1)

Unpanic。 Connections是一个反击。这些更有趣Connections / UptimeThreads_running。请注意,Max_used_connections仅为11.这没关系。

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

你有某种形式的"连接池"?代理服务器? MaxScale? HAProxy的?也许你正在看到"汇集"联系,而不是真实的。