解决使用innobackupex备份mysql产生returned OS error 124【转】
###简介
今天在使用innobackupex全量备份数据库的时候发生了下面的错误
错误详情
190705 15:22:18 >> log scanned up to (258819807308) xtrabackup: Generating a list of tablespaces InnoDB: Allocated tablespace ID 565 for new/sgk, 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 ./GroupData5/Group499.ibd: 'open' returned OS error 124. Cannot continue operation InnoDB: Cannot continue operation.
解决方式
这个是指mysql进程超出了打开最多的文件数量,检查下mysql数据文件data目录下的文件总数。
[root@nbpi-centos-tpl backup]# find /data -type f|wc -l 2644
接着我们查看mysql中innodb_open_files这个参数
登录mysql,执行
mysql> show variables like '%open_files%'; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | innodb_open_files | 2000 | | open_files_limit | 5000 | +-------------------+-------+ 2 rows in set (0.00 sec)
innodb_open_files的意思是限制Innodb能打开的表的数据。
这里设置的是2000默认值,但是数据库文件已经达到2644个了,所以报错,我们修改my.cnf中这个数值,之后重启就好了,如果没有,那就添加上
vim /etc/my.cnf
在[mysqld]
下加入innodb_open_files=5000
之后重启服务器
systemctl restart mysql
登录数据库查看验证一下
show variables like '%open_files%';
之后重新备份就没有这个错误了,如果还有那么就是系统可以打开的最大文件数目的问题了,执行
ulimit -a
查看系统open files这个值,之后使用
ulimit -n 5000
设置大就好了
我是设置ulimit -n 5000后执行备份就正常了。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-12-16 Nginx负载均衡配置权重方法【转】
2020-12-16 keepalived非争抢机制不生效报错Received lower prio advert, forcing new election
2020-12-16 MySQL主从复制,启动slave时报错1872 Slave failed to initialize relay log info structure from the repository
2019-12-16 修改jar包中的文件