innobackupex: Error: Original data directory '.' is not empty

innobackupex恢复时遇到三个错误:

错误信息:
1. innobackupex: Error: Original data directory '.' is not empty! at /usr/bin/innobackupex line 2162
2. innobackupex: Error: Original data directory '/db/mysql5.6/data' does not exist! at /usr/bin/innobackupex line 2141
3. innobackupex: Error: Cannot overwrite file: /db/mysql5.6/redo/ib_logfile1 at /usr/bin/innobackupex line 2177.

解决方法:
1.指定--defaults-file
2.创建datadir
3.删除ib_logfile*


错误重现:

1. 用innobackupex恢复时没指定参数defaults-file
$innobackupex --copy-back /home/mysqlweb/2014-10-27_14-57-31/

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.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

IMPORTANT: Please check that the copy-back run completes successfully.
           At the end of a successful copy-back run innobackupex
           prints "completed OK!".
innobackupex: Error: Original data directory '.' is not empty! at /usr/bin/innobackupex line 2162

$ls -l  /db/mysql5.6/data
total 0

错误信息时Original data directory '.' is not empty,貌似mysql的datadir非空。
实际上这个目录是空的。原因是没有指定my.cnf的路径。


2.用innobackupex恢复时,datadir不存在
$innobackupex --defaults-file=/db/mysql5.6/my.cnf --copy-back /home/mysqlweb/2014-10-27_14-57-31/
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.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

IMPORTANT: Please check that the copy-back run completes successfully.
           At the end of a successful copy-back run innobackupex
           prints "completed OK!".

innobackupex: Error: Original data directory '/db/mysql5.6/data' does not exist! at /usr/bin/innobackupex line 2141

原因:mysql的datadir目录不存在。

$ ll /db/mysql5.6/data
ls: cannot access /db/mysql5.6/data: No such file or directory

创建相关的datadir目录即可。
$ mkdir -p  /db/mysql5.6/data

 

3. 用innobackupex恢复时,ib_logfile*文件未删除
$innobackupex --defaults-file=/db/mysql5.6/my.cnf --copy-back /home/mysqlweb/2014-10-27_14-57-31/
innobackupex: Starting to copy InnoDB log files
innobackupex: in '/home/mysqlweb/2014-10-27_14-57-31'
innobackupex: back to original InnoDB log directory '/db/mysql5.6/redo/'
innobackupex: Error: Cannot overwrite file: /db/mysql5.6/redo/ib_logfile1 at /usr/bin/innobackupex line 2177.

$ll /db/mysql5.6/redo
total 393216
-rw-r--r-- 1 mysqlweb mysql 134217728 2014-10-27 16:25:21 ib_logfile0
-rw-r--r-- 1 mysqlweb mysql 134217728 2014-10-27 16:25:21 ib_logfile1
-rw-r--r-- 1 mysqlweb mysql 134217728 2014-10-27 16:25:21 ib_logfile2

删除ib_logfile*文件后恢复正常。
$rm -rf ib_logfile*

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值