一个MySQL数据库备份的时候出现下面的错误:
InnoDB: Operating system error number 24 in a file operation. InnoDB: Error number 24 means ‘Too many open files’ InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
检查发现数据文件太多:
一共90811个数据文件。
查看打开的文件数:
[root@localhost ~]# ulimit -Sn 1024 [root@localhost ~]# ulimit -Hn 4096
这个检查命令的说明:
ulimit [-HSTabcdefilmnpqrstuvx [limit]] Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The -H and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. -n The maximum number of open file descriptors (most systems do not allow this value to be set)
查询操作系统运行打开的最大文件数:
# cat /proc/sys/fs/nr_open 1048576
在文件 /etc/security/limits.conf 设置:
mysql hard nofile 65535 mysql soft nofile 65535 mysql hard nproc 65535 mysql soft nproc 65535
也可以把mysql用*代替。
重新备份问题解决。