MySQL 利用XtraBackup进行增量备份详细过程汇总(十)

2015-04-07 14:10:28 · 作者: · 浏览: 215
0150321/user_db/test2.ibd.delta to./user_db/test2.ibd...
xtrabackup: page size for/data/backups/mysql/incre_20150321/user_db/test.ibd.delta is 16384 bytes
Applying/data/backups/mysql/incre_20150321/user_db/test.ibd.delta to./user_db/test.ibd...
xtrabackup: page size for/data/backups/mysql/incre_20150321/user_db/t1.ibd.delta is 16384 bytes
Applying/data/backups/mysql/incre_20150321/user_db/t1.ibd.delta to ./user_db/t1.ibd...
xtrabackup: page size for/data/backups/mysql/incre_20150321/user_db/UC_USER.ibd.delta is 16384 bytes
Applying/data/backups/mysql/incre_20150321/user_db/UC_USER.ibd.delta to./user_db/UC_USER.ibd...
xtrabackup: using the following InnoDBconfiguration for recovery:
xtrabackup:? innodb_data_home_dir = ./
xtrabackup:? innodb_data_file_path =IBdata1:128M;IBdata2:128M:autoextend
xtrabackup:? innodb_log_group_home_dir =/data/backups/mysql/incre_20150321
xtrabackup:? innodb_log_files_in_group = 1
xtrabackup:? innodb_log_file_size = 2097152
xtrabackup: Starting InnoDB instance forrecovery.
xtrabackup: Using 104857600 bytes forbuffer pool (set by --use-memory parameter)
InnoDB: Using atomics to ref count bufferpool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomicbuiltins
InnoDB: Memory barrier is not used
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, size =100.0M
InnoDB: Completed initialization of bufferpool
InnoDB: Highest supported file format isBarracuda.
InnoDB: The log sequence numbers 423925813and 423925813 in ibdata files do not match the log sequence number 423931610 inthe ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information fromthe .ibd files...
InnoDB: Restoring possible half-writtendata pages
InnoDB: from the doublewrite buffer...
InnoDB: Last MySQL binlog file position 0915, file name mysql-bin.000053
?
[notice (again)]
? Ifyou use binary log and don't use any hack of group commit,
? thebinary log position seems to be:
InnoDB: Last MySQL binlog file position 0915, file name mysql-bin.000053
?
xtrabackup: starting shutdown withinnodb_fast_shutdown = 1
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequencenumber 423931610
[root@data01 mysql]#



?


?


4.5 恢复整个库


恢复命令:


xtrabackup --defaults-file=/etc/my.cnf--prepare --user=backup --password="123456"--target-dir=/data/backups/mysql/full_incre_20150319 2>/tmp/restore_end_3.log


停止mysql服务:


service mysqld5612 stop


开始rsync数据文件:


cd /data/backups/mysql/full_incre_20150319


rsync -rvt --exclude'xtrabackup_checkpoints' --exclude 'xtrabackup_logfile'? ./ /home/data/mysql/data


授予mysql访问权限:


chown -R mysql:mysql /home/data/mysql/data


启动mysql服务:


service mysqld5612 start


?



4.6,验证


登录mysql,看到以前在备份之后删除的t4以及t_incre_2表的数据已经通过2次增量备份恢复过来了,如下所示:


?


mysql> select * from t4;
+-----+---+
| a? | b |
+-----+---+
| aaa | 1 |
| bbb | 2 |
+-----+---+
2 rows in set (0.05 sec)
?
mysql> select * from t_incre_2;
+----+---+
| a | b |
+----+---+
| cc | 2 |
| dd | 2 |
+----+---+
2 rows in set (0.06 sec)
?
mysql>