解決使用innobackupex備份mysql產生returned OS error 124
阿新 • • 發佈:2019-07-08
###簡介
今天在使用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,執行
show variables like '%open_files%';
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
設定大就好了
歡迎關注Bboysoul的部落格www.bboy