有的时候MySQL负载过高,需要查看是哪里链接的为什么高负载,这里就需要查看MySQL的链接数
查看命令:show processlist;
show processlist命令可以查看当前用户的的连接数(root用户可以查看所有用户的连接情况)。
mysql> show processlist;
+-----------+----------+---------------------+----------+---------+-------+-------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----------+----------+---------------------+----------+---------+-------+-------+------------------------------------------------------------------------------------------------------+
| 102633376 | user | 10.222.4.233:56765 | WSC_LOGS | Sleep | 6279 | | NULL |
| 102784700 | user | 10.222.4.233:42896 | WSC_LOGS | Sleep | 25242 | | NULL |
| 103201035 | wsc_user | 10.222.4.243:56136 | WSC_LOGS | Sleep | 97 | | NULL |
| 103201172 | wsc_user | 172.27.195.52:35419 | WSC_LOGS | Sleep | 95 | | NULL |
| 103201222 | wsc_user | 172.27.195.52:35426 | WSC_LOGS | Sleep | 92 | | NULL |
| 103203044 | wsc_user | 172.27.195.52:35476 | WSC_LOGS | Sleep | 46 | | NULL |
| 103203209 | wsc_user | 10.222.4.247:57892 | WSC_LOGS | Query | 0 | NULL | show processlist |
| 103203575 | wsc_user | 100.66.30.152:60166 | WSC_LOGS | Query | 0 | NULL | insert into ComponentLog_20170330(starttime, taskid, comid, output, idx) values(FROM_UNIXTIME(149087 |
| 103203576 | wsc_user | 100.66.30.152:60168 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203577 | wsc_user | 100.66.30.152:60167 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203578 | wsc_user | 100.66.30.152:60169 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203580 | wsc_user | 100.66.30.152:60172 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203581 | wsc_user | 100.66.30.152:60171 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203582 | wsc_user | 100.66.30.152:60173 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203583 | wsc_user | 100.66.30.152:60175 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203585 | wsc_user | 100.66.30.152:60177 | WSC_LOGS | Query | 0 | NULL | insert into ComponentLog_20170330(starttime, taskid, comid, output, idx) values(FROM_UNIXTIME(149087 |
| 103203587 | wsc_user | 100.66.30.152:60179 | WSC_LOGS | Sleep | 0 | | NULL |
| 103203588 | wsc_user | 100.66.30.152:60180 | WSC_LOGS | Sleep | 0 | | NULL |
+-----------+----------+---------------------+----------+---------+-------+-------+------------------------------------------------------------------------------------------------------+
18 rows in set (0.00 sec)
这里对其中的列信息进行简单的说明:
备注:show processlist最多只列出前100条信息,如果想全列出可以使用show full processlist;
网友评论