mysql 服务器挂在‘显示进程列表’上

mysql 服务器挂在‘显示进程列表’上

我遇到了一个问题,我的 mysql 服务器进入了基本操作永远挂起的状态。

$ mysql -ubuildbot -p -hdbserver
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7406
Server version: 5.5.9-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mydb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show processlist;
[hangs forever]
^C^C^C^C^C^C^C^C^C
[still stuck]

否,不是磁盘空间不足。CPU 使用率很低。

iostat 输出:

Linux 2.6.28-11-server (PSDB102)    04/22/2011  _x86_64_    (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.65    0.01    0.62    0.09    0.00   95.74

答案1

我建议你看一下error_log,它可能会给你一些提示,让你知道发生了什么。如果error_log没有输出任何有用的信息,那么就strace可以解决问题了。

使用方式如下:

strace -f -o strace.output -p pid_of_mysqld_parent

这将跟踪 MySQL 服务器进程及其子进程(因此使用 -f 标志)进行的所有系统调用,并将它们输出到名为 strace.output 的文件中。然后,在运行 strace 时,连接到 MySQL 并按照上述步骤操作,直到进程挂起。挂起后,CTRL+C在 strace 终端上键入并查看文件。这可能会启发您并为您提供一些有关正在发生的事情的线索。

问题也可能出在客户端,因此如果上述输出没有帮助,您可能需要跟踪客户端:

 strace -f -o strace.output mysql -ubuildbot -p -hdbserver

然后,您只需在它挂起后查看 strace.output。

希望这可以帮助!

相关内容