xtrabackup备份MySQL报错:InnoDB: Error number 24 means 'Too many open files'


1.使用xtrabackup备份MySQL时出现如下报错:

190228 00:30:01 >> log scanned up to (88343615848)
xtrabackup: Generating a list of tablespaces
InnoDB: Allocated tablespace ID 2 for mysql/plugin, old maximum was 0
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
InnoDB: File ./jira/AO_4B00E6_STASH_SETTINGS.ibd: 'open' returned OS error 124. Cannot continue operation
InnoDB: Cannot continue operation.



2.查看备份使用的user的ulimit

[root@linux mysql]# 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) 385500
max locked memory (kbytes, -l) 64
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) 385500
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited



3.修改/etc/security/limits.conf

vim /etc/security/limits.conf

* soft nofile 65535

* hard nofile 65535


重新备份还是报错。


4.修改MySQL的配置文件,增加如下参数:

vim /etc/my.cnf

innodb_open_files=1000


重新备份成功!



-----------------------------------------要克服生活的焦虑和沮丧,得先学会做自己的主人-----------------------------------------