温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql备份提示too many open files Errornumber 24怎么解决

发布时间:2021-09-08 16:38:49 来源:亿速云 阅读:185 作者:chen 栏目:MySQL数据库

本篇内容主要讲解“mysql备份提示too many open files Errornumber 24怎么解决”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“mysql备份提示too many open files Errornumber 24怎么解决”吧!

一.问题的描述

备份程序 执行前滚的时候报错。

InnoDB: Errornumber 24 means 'Too many open files'.
InnoDB: Some operatingsystem error numbers are described at
InnoDB: http://dev.MySQL.com/doc/mysql/en/Operating_System_error_codes.html
InnoDB: File name/home/nice/backup/mysql/var.20121211021656/user_db_20121123/tuser_like_core.ibd
InnoDB: File operationcall: 'open'.
InnoDB: Cannot continueoperation.
 
innobackup:Error:

二.问题分析

openfiles 开的小了。
mysql的open_file_limit受制于以下几个参数
max_connections、 table_open_cache 、open_files_limit 以及 /etc/security/limits.conf中的配置。
max_connections和 table_open_cache 与open_files_limit 的关系:
  max_1 = 10 + max_connections + table_cache * 2;
  max_2 = max_connections * 5;
  max_3 = max_os_open_files;//操作系统单个进程最大允许打开文件句柄(文件描述符)。
   open_files_limit= max( max_1, max_2 ) > max_3 ? max_3 : max ( max_1, max_2);
综合分析发现,open_files_limit  | 10240
而目前ibd表已经10800个了。

三.解决问题

1.my.cnf  配置 open_files_limit         = 20480

重启mysql 发现没有变化,open_files_limit  | 10240。

2.ulimit -a

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
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
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 137216
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

3.vi /etc/security/limits.conf,添加

mysql            soft    nofile          8192
mysql            hard    nofile          20480

4.经过前三步,重启mysql。

重启mysql 发现,open_files_limit  | 20480。

5.修改OS用户配置文件

经过前四步,虽然在mysql中 看open_files_limit  | 20480,但ibbackup还是在前滚时报错。报,open_file不够。怀疑 还是没有生效。

ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
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
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 137216
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

于是,修改OS用户配置文件

分别查看了.bash_profile 、.bashrc 、/etc/bashrc;

发现,.bash_profile调用 .bashrc ,.bashrc调用 /etc/bashrc

发现,/etc/bashrc 中有  

ulimit -S -c unlimited > /dev/null 2>&1

在这一行之后 添加

ulimit -n 20480 >/dev/null 2>&1

6.重启mysql ,执行备份程序,在--apply-log,还是报错,报,open_file不够

InnoDB: Errornumber 24 means 'Too many open files'.
InnoDB: Some operatingsystem error numbers are described at
InnoDB: http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html

7.修改innodb_open_files 参数

之前这个参数,设置成500.这次修改到1000.

重启mysql 解决问题

到此,相信大家对“mysql备份提示too many open files Errornumber 24怎么解决”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI