基于Innobackupex的增备及恢复(2)

141222 14:55:08  innobackupex: Starting to backup non-InnoDB tables and files  --开始备份非innodb
innobackupex: in subdirectories of '/data/inst3606/data3606'                  --所有的非innodb会被重新备份一次
innobackupex: Backing up files '/data/inst3606/data3606/mysql/*.{frm,isl,MYD,...,CSV,opt,par}' (77 files)

141222 14:55:09  innobackupex: Executing FLUSH ENGINE LOGS...                  --日志切换
141222 14:55:09  innobackupex: Waiting for log copying to finish

xtrabackup: The latest check point (for incremental): '391476794'              --检查点位置
xtrabackup: Stopping log copying thread.
.>> log scanned up to (391476794)
  --........非重要信息忽略........
xtrabackup: Creating suspend file '/hotbak/inc/xtrabackup_log_copied' with pid '25001'
xtrabackup: Transaction log of lsn (391476794) to (391476794) was copied.        --复制事务日志
141222 14:55:10  innobackupex: All tables unlocked                              --表解锁
  --........非重要信息忽略........
141222 14:55:10  innobackupex: completed OK!

d、查看增备后的相关文件
SHELL>  ls -hltr /hotbak/inc/*delta*
-rw-r----- 1 root root 96K 2014/12/22 14:55 /hotbak/inc/ibdata1.delta

SHELL>  more /hotbak/inc/xtrabackup_info|grep ^incremental 
incremental = Y

--文件xtrabackup_checkpoints包含了备份的相关检查点信息
SHELL>  more /hotbak/inc/xtrabackup_checkpoints
backup_type = incremental
from_lsn = 391476482
to_lsn = 391476794
last_lsn = 391476794
compact = 0

--文件xtrabackup_binlog_info包含了binlog的位置
SHELL>  more xtrabackup_binlog_info
inst3606bin.000010      874

--再次新增一条记录,看看增备能否恢复
robin@localhost[tempdb]> insert into tb values(3,'Inbinlog');
Query OK, 1 row affected (0.00 sec)

3、恢复增量备份

a、先做基于全备的apply,注意,此时使用了--redo-only
SHELL> innobackupex --apply-log --redo-only --user=robin -password=xxx --port=3606 \
> --defaults-file=/etc/my3606.cnf /hotbak/full

b、基于增备的apply,
--此时没有--redo-only,如果有多个增备,仅仅最后一个增备无需指定--redo-only
SHELL> innobackupex --apply-log --user=robin -password=xxx --port=3606 --defaults-file=/etc/my3606.cnf \
> /hotbak/full --incremental-dir=/hotbak/inc
  --........非重要信息忽略........
xtrabackup: page size for /hotbak/inc/tempdb/tb.ibd.delta is 16384 bytes
Applying /hotbak/inc/tempdb/tb.ibd.delta to ./tempdb/tb.ibd...  --可以看到数据库tempdb下表tb被apply到全备目录
xtrabackup: page size for /hotbak/inc/sakila/t.ibd.delta is 16384 bytes
Applying /hotbak/inc/sakila/t.ibd.delta to ./sakila/t.ibd...
          -- ........非重要信息忽略........
xtrabackup: Starting InnoDB instance for recovery.              --启动InnoDB实例恢复
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
  --........非重要信息忽略........
InnoDB: Highest supported file format is Barracuda.
InnoDB: The log sequence numbers 391476482 and 391476482 in ibdata files do not match
  the log sequence number 391476794 in the ib_logfiles! --提示log sequence不一致
InnoDB: Database was not shutdown normally!             
InnoDB: Starting crash recovery.                        --启动crash recovery
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages
InnoDB: from the doublewrite buffer...
InnoDB: Last MySQL binlog file position 0 874, file name inst3606bin.000010
InnoDB: 128 rollback segment(s) are active.            --提示有一些rollback段是活动的
InnoDB: Waiting for purge to start
InnoDB: 5.6.21 started; log sequence number 391476794
  --........非重要信息忽略........ Author: Leshami Blog: <A href="https://www.linuxidc.com" target=_blank>
innobackupex</A>: Starting to copy non-InnoDB files in '/hotbak/inc'
innobackupex: to the full backup directory '/hotbak/full'  --将非InnoDB表复制到全备目录,覆盖方式
innobackupex: Copying '/hotbak/inc/xtrabackup_binlog_info' to '/hotbak/full/xtrabackup_binlog_info'
  ........非重要信息忽略........
141222 16:19:52  innobackupex: completed OK!            --完成基于增量的合并

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/cee60a83a55df4cb96e2bd1274f7dfc6.html