原文链接:http://www.cnblogs.com/digdeep/p/4946230.html
(root@localhost)[(none)]mysql>show grants for 'bkpuser'@'localhost'\G *************************** 1. row *************************** Grants for bkpuser@localhost: GRANT RELOAD, PROCESS, SUPER, LOCK TABLES, REPLICATION CLIENT, CREATE TABLESPACE ON *.* TO 'bkpuser'@'localhost' IDENTIFIED BY PASSWORD '*BDC62F68AF8F0B8BFAE27FF782C5D8CE9F4BAFCB' 1 row in set (0.00 sec)
2. innobackupex 命令选项:
innobackupex --help
View Code
[root@localhost ~]# innobackupex --apply-log /backup/xtrabackup/full/ --user=bkpuser --password=digdeep 151106 10:41:48 innobackupex: Starting the apply-log operation IMPORTANT: Please check that the apply-log run completes successfully. At the end of a successful apply-log run innobackupex prints "completed OK!". innobackupex version 2.3.2 based on MySQL server 5.6.24 Linux (i686) (revision id: 306a2e0) xtrabackup: cd to /backup/xtrabackup/full xtrabackup: Error: cannot open ./xtrabackup_checkpoints xtrabackup: error: xtrabackup_read_metadata() xtrabackup: This target seems not to have correct metadata... 2015-11-06 10:41:48 b771e6d0 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. 2015-11-06 10:41:48 b771e6d0 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.
View Code
[root@localhost mysql]# innobackupex --copy-back /backup/xtrabackup/full/2015-11-05_22-38-55/ --user=bkpuser --password=digdeep 151106 11:07:38 innobackupex: Starting the copy-back operation IMPORTANT: Please check that the copy-back run completes successfully. At the end of a successful copy-back run innobackupex prints "completed OK!". innobackupex version 2.3.2 based on MySQL server 5.6.24 Linux (i686) (revision id: 306a2e0) 151106 11:07:38 [01] Copying ib_logfile0 to /var/lib/mysql/ib_logfile0 151106 11:07:40 [01] ...done 151106 11:07:40 [01] Copying ib_logfile1 to /var/lib/mysql/ib_logfile1 151106 11:07:41 [01] ...done 151106 11:07:41 [01] Copying ibdata1 to /var/lib/mysql/ibdata1 151106 11:07:45 [01] ...done 151106 11:07:45 [01] Copying ./xtrabackup_info to /var/lib/mysql/xtrabackup_info 151106 11:07:45 [01] ...done 151106 11:07:45 [01] Copying ./mysql/slave_master_info.ibd to /var/lib/mysql/mysql/slave_master_info.ibd 151106 11:07:45 [01] ...done [... ...] 151106 11:07:57 [01] Copying ./t/db.opt to /var/lib/mysql/t/db.opt 151106 11:07:57 [01] ...done 151106 11:07:57 [01] Copying ./t/t.frm to /var/lib/mysql/t/t.frm 151106 11:07:57 [01] ...done 151106 11:07:57 completed OK! [root@localhost mysql]# pwd /var/lib/mysql [root@localhost mysql]# ls aazj ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema t xtrabackup_binlog_pos_innodb xtrabackup_info
[root@localhost mysql]# ls -l total 176164 drwx------ 2 root root 4096 Nov 6 11:07 aazj -rw-rw---- 1 mysql mysql 543 Nov 6 11:13 general.log -rw-r----- 1 root root 79691776 Nov 6 11:07 ibdata1 -rw-r----- 1 root root 50331648 Nov 6 11:07 ib_logfile0 -rw-r----- 1 root root 50331648 Nov 6 11:07 ib_logfile1 -rw-rw---- 1 mysql mysql 543 Nov 6 11:13 localhost-slow.log drwx------ 2 root root 4096 Nov 6 11:07 mysql -rw-rw---- 1 mysql mysql 0 Nov 6 11:12 mysql-bin.index drwx------ 2 root root 4096 Nov 6 11:07 performance_schema drwx------ 2 root root 4096 Nov 6 11:07 t -rw-r----- 1 root root 24 Nov 6 11:07 xtrabackup_binlog_pos_innodb -rw-r----- 1 root root 487 Nov 6 11:07 xtrabackup_info [root@localhost mysql]# chown -R mysql:mysql /var/lib/mysql [root@localhost mysql]# ls -l total 176164 drwx------ 2 mysql mysql 4096 Nov 6 11:07 aazj -rw-rw---- 1 mysql mysql 543 Nov 6 11:13 general.log -rw-r----- 1 mysql mysql 79691776 Nov 6 11:07 ibdata1 -rw-r----- 1 mysql mysql 50331648 Nov 6 11:07 ib_logfile0 -rw-r----- 1 mysql mysql 50331648 Nov 6 11:07 ib_logfile1 -rw-rw---- 1 mysql mysql 543 Nov 6 11:13 localhost-slow.log drwx------ 2 mysql mysql 4096 Nov 6 11:07 mysql -rw-rw---- 1 mysql mysql 0 Nov 6 11:12 mysql-bin.index drwx------ 2 mysql mysql 4096 Nov 6 11:07 performance_schema drwx------ 2 mysql mysql 4096 Nov 6 11:07 t -rw-r----- 1 mysql mysql 24 Nov 6 11:07 xtrabackup_binlog_pos_innodb -rw-r----- 1 mysql mysql 487 Nov 6 11:07 xtrabackup_info
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
/var/lib/mysql
It can also be done by copying back the prepared backup to a clean datadir (in that case, make sure to include the mysql database). System database can be created with: $ sudo mysql_install_db --user=mysql (摘自xtrabackup文档)
This option, when specified, makes --copy-back or
--move-back transfer files to non-empty directories. Note
that no existing files will be overwritten. If
--copy-back or --nove-back has to copy a file from the
backup directory which already exists in the destination
directory, it will still fail with an error.
即使带上了该参数,如果还存在重名的文件,还是会报错,需要先删除datadir中的重名文件。

2318



被折叠的 条评论
为什么被折叠?



