I
I
int03e2013-07-03 19:46:34
MySQL
int03e, 2013-07-03 19:46:34

Database backup with Percona xtrabackup

Hey! I have been struggling with the task for quite some time, it seems that it is time to ask for advice.
There is mysql innodb with percona, Server version: 5.5.28-29.2-log Percona Server (GPL), Release 29.2. There is a desire to take a backup from one database on this server, and upload it to the same server, but to another database. The dumps are quite large (currently 45Gb, but maybe 200), so mysqldump is not suitable.
In the muscle, innodb_import_table_from_xtrabackup and innodb_file_per_table are set.

Removing a backup

cd /path/to/backup/ && sudo rm -r * && sudo xtrabackup --backup --datadir=/SSD/mysql --target-dir= /path/to/backup/ --tables="^source_db[.].*"

xtrabackup --prepare --export --target-dir=/path/to/backup/ 


Creating a new database and uploading a backup
mysql -'user' -p'pass' -e 'CREATE DATABASE IF NOT EXISTS destination_db DEFAULT CHARSET utf8;'

mysql -'user' -p'pass'  destination_db < database_schema.sql

mysql -u'user -p'pass' -Nse 'show tables' destination_db | while read table; do mysql -u'user' -p'pass' -e "ALTER TABLE $table DISCARD TABLESPACE" destination_db; done

find /path/to/backup/source_db  -name '*.ibd' -exec sudo cp {} /SSD/mysql/destination_db \;

chown -R mysql:mysql /SSD/mysql/destination_db/

sudo chmod -R 660 /SSD/mysql/destination_db/

mysql -u'user' -p'pass' -Nse 'show tables' destination_db | while read table; do mysql -u'user' -p'apass' -e "ALTER TABLE $table IMPORT TABLESPACE" destination_db; done


Everything is good, until it reaches alter table $table import tablespace, mysql issues ERROR 1030 (HY000): Got error -1 from storage engine. In /var/log/mysql/error.log entries like this:

130703 20:10:19 InnoDB: Error: trying to open a table, but could not
InnoDB: open the tablespace file './db666/zreports.ibd'!
130703 20:10:19 InnoDB: Error: cannot reset lsn's in table `db666`.`zreports`
InnoDB: in ALTER TABLE… IMPORT TABLESPACE
130703 20:12:22 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
130703 20:12:22 InnoDB: Error: trying to open a table, but could not
InnoDB: open the tablespace file './db666/zreports.ibd'!
130703 20:12:22 InnoDB: Error: cannot reset lsn's in table `db666`.`zreports`
InnoDB: in ALTER TABLE... IMPORT TABLESPACE

? There is space on the disk, the rights (despite the error in the log) seem to be correct.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2013-07-03
@L3n1n

Here's a guy with a similar problem. I see you have the same thing
unixway.info/mysql/innodb-the-error-means-mysqld-does-not-have-the-access-rights-to-the-directory/

U
uMg, 2013-07-04
@uMg

try to dump not xtrabackup but xtrabackup_55
xtrabackup does not work with Percona above 5.1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question