问题描述
mysqldump: Couldn't execute 'show fields from `tablename`': Out of resources when opening file './databasename/tablename#P#p125.MYD' (Errcode: 24) (23)
检查错误消息说它在外壳上的错误24
on checking the error 24 on the shell it says
>>perror 24
OS error code 24: Too many open files
我该如何解决?
推荐答案
首先,要确定特定的用户或组限制,您必须执行以下操作:
At first, to identify the certain user or group limits you have to do the following:
root@ubuntu:~# sudo -u mysql bash
mysql@ubuntu:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 71680
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 71680
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
mysql@ubuntu:~$
重要的一行是:
打开文件(-n)1024
如您所见,您的操作系统供应商附带了该版本的基本Linux配置-每个进程1024个文件.
As you can see, your operating system vendor ships this version with the basic Linux configuration - 1024 files per process.
对于忙碌的MySQL安装来说,这显然是不够的.
This is obviously not enough for a busy MySQL installation.
现在,要解决此问题,您必须修改以下文件:
Now, to fix this you have to modify the following file:
/etc/security/limits.conf
/etc/security/limits.conf
mysql soft nofile 24000
mysql hard nofile 32000
某些版本的Linux还需要进行其他配置,以使其坚持到守护进程而不是登录会话.例如,在Ubuntu 10.04中,还需要通过将以下行添加到/etc/pam.d/common-session
来设置pam会话限制:
Some flavors of Linux also require additional configuration to get this to stick to daemon processes versus login sessions. In Ubuntu 10.04, for example, you need to also set the pam session limits by adding the following line to /etc/pam.d/common-session
:
session required pam_limits.so
这篇关于Ubuntu 8.04上打开文件错误过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!