溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

mysql備份提示too many open files Errornumber 24怎么解決

發(fā)布時(shí)間:2021-09-08 16:38:49 來源:億速云 閱讀:193 作者:chen 欄目:MySQL數(shù)據(jù)庫

本篇內(nèi)容主要講解“mysql備份提示too many open files Errornumber 24怎么解決”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“mysql備份提示too many open files Errornumber 24怎么解決”吧!

一.問題的描述

備份程序 執(zhí)行前滾的時(shí)候報(bào)錯(cuò)。

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受制于以下幾個(gè)參數(shù)
max_connections、 table_open_cache 、open_files_limit 以及 /etc/security/limits.conf中的配置。
max_connections和 table_open_cache 與open_files_limit 的關(guān)系:
  max_1 = 10 + max_connections + table_cache * 2;
  max_2 = max_connections * 5;
  max_3 = max_os_open_files;//操作系統(tǒng)單個(gè)進(jìn)程最大允許打開文件句柄(文件描述符)。
   open_files_limit= max( max_1, max_2 ) > max_3 ? max_3 : max ( max_1, max_2);
綜合分析發(fā)現(xiàn),open_files_limit  | 10240
而目前ibd表已經(jīng)10800個(gè)了。

三.解決問題

1.my.cnf  配置 open_files_limit         = 20480

重啟mysql 發(fā)現(xiàn)沒有變化,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.經(jīng)過前三步,重啟mysql。

重啟mysql 發(fā)現(xiàn),open_files_limit  | 20480。

5.修改OS用戶配置文件

經(jīng)過前四步,雖然在mysql中 看open_files_limit  | 20480,但ibbackup還是在前滾時(shí)報(bào)錯(cuò)。報(bào),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;

發(fā)現(xiàn),.bash_profile調(diào)用 .bashrc ,.bashrc調(diào)用 /etc/bashrc

發(fā)現(xiàn),/etc/bashrc 中有  

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

在這一行之后 添加

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

6.重啟mysql ,執(zhí)行備份程序,在--apply-log,還是報(bào)錯(cuò),報(bào),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 參數(shù)

之前這個(gè)參數(shù),設(shè)置成500.這次修改到1000.

重啟mysql 解決問題

到此,相信大家對(duì)“mysql備份提示too many open files Errornumber 24怎么解決”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI