朋友微信留言,说他使用xtrabackup备份的数据除了问题,不能还原了。让他把日志发来看看:
# /usr/bin/xtrabackup --defaults-file=/etc/my.cnf --prepare --target-dir=/tmp/a xtrabackup: recognized server arguments: xtrabackup: recognized client arguments: --prepare=1 --target-dir=/tmp/a /usr/bin/xtrabackup version 2.4.26 based on MySQL server 5.7.31 Linux (x86_64) (revision id: 19de43b) xtrabackup: cd to /tmp/a/ xtrabackup: This target seems to be not prepared yet. InnoDB: Number of pools: 1 InnoDB: Operating system error number 2 in a file operation. InnoDB: The error means the system cannot find the path specified. xtrabackup: Warning: cannot open ./xtrabackup_logfile. will try to find. InnoDB: Operating system error number 2 in a file operation. InnoDB: The error means the system cannot find the path specified. xtrabackup: Fatal error: cannot find ./xtrabackup_logfile. xtrabackup: Error: xtrabackup_init_temp_log() failed.
从这里看是,找不到备份文件xtrabackup_logfile。
让后让他进入备份路径target-dir看一下,发现的确是没有文件xtrabackup_logfile,但是有文件xtrabackup_logfile.qp
很明显,备份时使用了压缩选项。而在prepare之前,没有做解压缩操作。
解压一下即可:
/usr/bin/xtrabackup --decompress --parallel=4 --target-dir=/tmp/a