xtrabackup: error: xb_load_tablespaces() failed with error code 57
问题描述:在数据库上运行xtrabackup备份脚本出现的一些报错
DB_version:mysql8.0.26
Xtrabackup:percona-xtrabackup-8.0.27-19-Linux-x86_64.glibc2.12.tar.gz
[root@orch2 scripts]# $xtrDir --defaults-file=$mysql_cnf --user=$mysql_user --password=$mysql_password --socket=$mysql_socket --compress --compress-threads=2 --backup --target-dir=$target_dir xtrabackup: recognized server arguments: --datadir=/home/mysql/db_orch2/data --tmpdir=/home/mysql/db_orch2/tmp --log_bin=/home/mysql/db_orch2/binlog/orch2-bin --log-bin-index=/home/mysql/db_orch2/binlog/orch2-bin.index --server-id=1330611 --innodb_open_files=63000 --innodb_data_home_dir=/home/mysql/db_orch2/data --innodb_log_group_home_dir=/home/mysql/db_orch2/data --innodb_log_file_size=8G --innodb_log_files_in_group=4 --innodb_undo_directory=/home/mysql/db_orch2/ulog --innodb_undo_tablespaces=3 --innodb_flush_log_at_trx_commit=2 --innodb_flush_method=O_DIRECT --innodb_io_capacity=3000 --innodb_buffer_pool_size=64G --innodb_log_buffer_size=32M --innodb_max_dirty_pages_pct=85 --innodb_adaptive_hash_index=1 --innodb_data_file_path=ibdata1:512M:autoextend --innodb_write_io_threads=16 --innodb_read_io_threads=16 xtrabackup: recognized client arguments: --user=root --password=* --socket=/home/mysql/db_orch2/mysql.sock --compress --compress-threads=2 --backup=1 --target-dir=/home/mysql/backup/13306//2022-04-06 /root/percona-xtrabackup/bin/xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda) Can't locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at - line 749. BEGIN failed--compilation aborted at - line 749. 220406 12:26:14 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /home/mysql/db_orch2/mysql.sock Using server version 8.0.26 220406 12:26:14 Executing LOCK INSTANCE FOR BACKUP... xtrabackup: uses posix_fadvise(). xtrabackup: cd to /home/mysql/db_orch2/data xtrabackup: open files limit requested 0, set to 1024 xtrabackup: using the following InnoDB configuration: xtrabackup: innodb_data_home_dir = /home/mysql/db_orch2/data xtrabackup: innodb_data_file_path = ibdata1:512M:autoextend xtrabackup: innodb_log_group_home_dir = /home/mysql/db_orch2/data xtrabackup: innodb_log_files_in_group = 4 xtrabackup: innodb_log_file_size = 8589934592 xtrabackup: using O_DIRECT Number of pools: 1 xtrabackup: inititialize_service_handles suceeded 220406 12:26:14 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /home/mysql/db_orch2/mysql.sock xtrabackup: Redo Log Archiving is not set up. Starting to parse redo log at lsn = 1276785485862 220406 12:26:14 >> log scanned up to (1276786464962) xtrabackup: Generating a list of tablespaces xtrabackup: Generating a list of tablespaces Scanning './' Scanning '/home/mysql/db_orch2/ulog/' Completed space ID check of 2 files. Allocated tablespace ID 2198 for eomaqzy_data/app_source_rela, old maximum was 0 220406 12:26:15 >> log scanned up to (1276786574060) Undo tablespace number 1 was being truncated when mysqld quit. Cannot recover a truncated undo tablespace in read-only mode xtrabackup: error: xb_load_tablespaces() failed with error code 57
查看数据文件目录下是否有undo文件,清理undo文件重新测试备份
mv undo*.log /tmp
报错二:
xtrabackup: Can't create/write to file '/home/mysql/backup/13306/2022-04-06/eomaqzy_data/pl02_inv_meter_data.ibd.qp' (OS errno 24 - Too many open files) 您在 /var/spool/mail/root 中有邮件
操作系统文件数未调整限制
[root@orch2 13306]# ulimit -n 1024 [root@orch2 ~]# grep -i nofile /etc/security/limits.conf # - nofile - max number of open file descriptors [root@orch2 ~]# vim /etc/security/limits.conf * hard nofile 65535 * soft nofile 65535 断开链接,重新登录 [root@orch2 ~]# ulimit -n 65535
重新备份
+ echo =========================Run full backup beginning========================== + /root/percona-xtrabackup/bin/xtrabackup --defaults-file=/home/mysql/db_orch2/conf/orch2.cnf --user=root --password=XXXXX --socket=/home/mysql/db_orch2/mysql.sock --compress --compress-threads=2 --backup --target-dir=/home/mysql/backup/13306/2022-04-06 + echo =========================Run full backup finished successfully========================== 您在 /var/spool/mail/root 中有邮件