更新服务器后 MySQL 无法打开文件:errno: 24

Van*_*Van 16 server mysql 12.04

Ubuntu: 12.04 LTS(Linux mysql02 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux)

MySQL: Ubuntu 发行版 5.5.31

服装商:移除

服务器已经运行了一年多。然后这个星期一 MySQL 开始失败。更新导致了问题,我们无法弄清楚它是什么。我们甚至尝试回滚到 MySQL 5.5.30,但没有成功。我们在 5.5.31 返回。

MySQL 错误日志条目:

130430  7:55:46 [ERROR] Error in accept: Too many open files
130430  7:55:46 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/fclvod.frm' (errno: 24)
130430  7:55:46 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/fcnote.frm' (errno: 24)
130430  7:55:47 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/ffcont.frm' (errno: 24)
130430  7:55:47 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/ffcontv.frm' (errno: 24)
130430  7:55:47 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/ffnote.frm' (errno: 24)
130430  7:55:47 [ERROR] /usr/sbin/mysqld: Can't open file: './eci_elite_test/frcfcl.frm' (errno: 24)
Run Code Online (Sandbox Code Playgroud)

看来我们遇到了 ulimit 问题。我们已经完全删除了 APPARMOR。我们增加了/etc/security/limits.conf,但仍然没有运气:

# Out of desperation....
* soft  nofile  49152
* hard  nofile  65536

# No effect!?!!?
#mysql  soft  nofile  49152
#mysql  hard  nofile  65536
Run Code Online (Sandbox Code Playgroud)

并显示limits.conf正在工作:

root@mysql02:/etc/security# ulimit -Sa | grep "open files"
open files                      (-n) 49152

root@mysql02:/etc/security# ulimit -Ha | grep "open files"
open files                      (-n) 65536
Run Code Online (Sandbox Code Playgroud)

这是my.cnf中的重要条目

[mysqld_safe]
open_files_limit = 16384

[mysqld]
open_files_limit = 16384
Run Code Online (Sandbox Code Playgroud)

然而:

root@mysql02:/etc/mysql# mysqladmin -u root -pThePassword variables| grep open_files_limit
open_files_limit                                  | 1024
Run Code Online (Sandbox Code Playgroud)

我们完全被难住了。任何帮助将不胜感激。

Van*_*Van 19

操作系统: Ubuntu (Debian) 部署

MySQL 服务器选项: open-files-limit

Debian新贵似乎不使用/etc/security/limits.conf 中定义的参数,因此当您通过service命令启动 mysql 时(因此,在新贵下),它会覆盖这些定义的限制并使用默认值 1024 .

解决方法是修改定义 upstart 服务的mysql.conf文件,它位于/etc/init/mysql.conf并在pre-start之前添加以下行:

# NB: Upstart scripts do not respect
# /etc/security/limits.conf, so the open-file limits
# settings need to be applied here.
limit nofile 32000 32000
limit nproc 32000 32000
Run Code Online (Sandbox Code Playgroud)

参考: