数据库
首页 > 数据库> > 12.04 – 更新服务器后MySQL无法打开文件:errno:24

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

作者:互联网

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

Apparmor:删除了!

服务器一直运行坚固一年多.然后本周一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)

看来我们遇到了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

并显示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

以下是my.cnf中的重要条目

[mysqld_safe]
open_files_limit = 16384

[mysqld]
open_files_limit = 16384

然而:

root@mysql02:/etc/mysql# mysqladmin -u root -pThePassword variables| grep open_files_limit
open_files_limit                                  | 1024

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

解决方法:

操作系统:Ubuntu(Debian)部署

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

似乎Debian upstart不使用/etc/security/limits.conf中定义的参数,所以当你通过service命令启动mysql时(在upstart下),它会覆盖那些定义的限制并使用默认的1024 .

解决方案是修改定义upstart服务的mysql.conf文件,它位于/etc/init/mysql.conf中,并在预启动块之前添加以下行:

# 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

参考文献:

> https://serverfault.com/questions/440878/changing-open-files-limit-in-mysql-5-5
> http://dev.mysql.com/doc/refman/5.5/en/server-options.html#c12634

标签:mysql,server,12-04
来源: https://codeday.me/bug/20190807/1614592.html