Percona XtraBackup:获取有关“打开文件太多”的错误,我该如何解决这个问题?

我正在尝试使用Percona XtraBackup进行备份并获取以下错误:

[root@ads-dev1 ~]# innobackupex /root/db InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved. This software is published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. 140722 11:52:16 innobackupex: Starting mysql with options: --unbuffered -- 140722 11:52:16 innobackupex: Connected to database with mysql child process (pid=15930) 140722 11:52:22 innobackupex: Connection to database server closed IMPORTANT: Please check that the backup run completes successfully. At the end of a successful backup run innobackupex prints "completed OK!". innobackupex: Using mysql Ver 14.12 Distrib 5.0.95, for redhat-linux-gnu (x86_64) using readline 5.1 innobackupex: Using mysql server version Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. innobackupex: Created backup directory /root/db/2014-07-22_11-52-22 140722 11:52:22 innobackupex: Starting mysql with options: --unbuffered -- 140722 11:52:22 innobackupex: Connected to database with mysql child process (pid=15953) 140722 11:52:24 innobackupex: Connection to database server closed 140722 11:52:24 innobackupex: Starting ibbackup with command: xtrabackup_51 --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/root/db/2014-07-22_11-52-22 --tmpdir=/tmp innobackupex: Waiting for ibbackup (pid=15959) to suspend innobackupex: Suspend file '/root/db/2014-07-22_11-52-22/xtrabackup_suspended' xtrabackup_51 version 2.0.8 for MySQL server 5.1.59 unknown-linux-gnu (x86_64) (revision id: 587) xtrabackup: uses posix_fadvise(). xtrabackup: cd to /var/lib/mysql xtrabackup: Target instance is assumed as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 3 xtrabackup: innodb_log_file_size = 536870912 xtrabackup: using O_DIRECT >> log scanned up to (94 3209639289) 140722 11:52:25 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 InnoDB: http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html InnoDB: Error: could not open single-table tablespace file InnoDB: ./roei_cc/transport.ibd! InnoDB: We do not continue the crash recovery, because the table may become InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it. InnoDB: To fix the problem and start mysqld: InnoDB: 1) If there is a permission problem in the file and mysqld cannot InnoDB: open the file, you should modify the permissions. InnoDB: 2) If the table is not needed, or you can restore it from a backup, InnoDB: then you can remove the .ibd file, and InnoDB will do a normal InnoDB: crash recovery and ignore that table. InnoDB: 3) If the file system or the disk is broken, and you cannot remove InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf InnoDB: and force InnoDB to continue crash recovery here. innobackupex: Error: ibbackup child process has died at /usr/bin/innobackupex line 386. [root@ads-dev1 ~]# 

我已经检查了文件的权限,但是找不到问题,我也尝试使用mysql用户运行命令,并得到相同的错误,甚至运行下一个命令:

 # ulimit -n 4096 ; innobackupex /root/db 

但得到了完全相同的错误,有什么想法?

通过对错误代码24做一点研究,这似乎是任何用户可以打开的数字文件的一个限制。

您可以通过运行ulimit -Hnulimit -Sn来find这些限制。 -Hn是由root设置的不可逾越的限制。

引用http://www.percona.com/forums/questions-discussions/percona-xtrabackup/8243-innobackupex-1-5-1-error-in-backup

你将不得不打开文件的限制,直到错误消失。 以root用户身份,首先: ulimit -a查找打开文件的当前最大数量,然后用ulimit -n 2048 / ulimit -n 4094等设置一个新的限制,可能递增到2的幂,直到find合适的大小你的实现。

对于这个问题,请增加ulimit。 首先检查ulimit -aulimit -Snulimit -Hn然后使用ulimit -n 10240来增加限制在我的情况下,在改变ulimit后Xtrabackup命令正常工作