我有一个问题,我的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
我build议你看看error_log ,它可能会给你一些提示。 如果error_log没有输出任何有用的信息,那么strace来救援。
像这样使用它:
strace -f -o strace.output -p pid_of_mysqld_parent
这将跟踪所有由MySQL服务器进程及其subprocess跟踪的所有系统调用(因此-f标志),并将其输出到名为strace.output的文件。 然后,当运行strace时,连接到MySQL并按照上面的步骤,直到进程挂起。 挂起后,在straceterminal上inputCTRL+C并查看该文件。 这可能会启发你的方式,并给你一些线索发生了什么事情。
这个问题也可能出现在客户端,所以如果上面的输出没有帮助的话,你可能需要对客户端进行调整:
strace -f -o strace.output mysql -ubuildbot -p -hdbserver
然后,在挂起之后,你只需要看看strace.output。
希望这可以帮助!