mysql 恢复原理_mysql之 Innobackupex全备恢复(原理、演示)

一、  Innobackupex恢复原理

After creating a backup, the data is not ready to be restored. There might be uncommitted transactions to be undone or transactions in the logs to be replayed. Doing those pending operations will make the data files consistent and it is the purpose of the prepare stage. Once this has been done, the data is ready to be used.

To prepare a backup with innobackupex you have to use the --apply-log and the path to the backup directory as an argument:

Innobackupex replayed the committed transactions in the log files (some transactions could have been done while the backup was being done) and rolled back the uncommitted ones. Once this is done, all the information lay in the tablespace (the InnoDB files), and the log files are re-created.

在备份期间(copy数据时)事务存在不一致,即copy开始时,有些事务已开始,有些刚刚开始,而copy结束前或结束后才提交或回滚。

这些不确定的事务需要在恢复前来确定最终是否最终提交或回滚。在这个阶段的操作称之为prepare阶段。

这个prepare阶段依赖于备份时的xtrabackup log(来自innodb logfile),使用--apply-log参数实现一致性。

--apply-log参数会根据xtrabackup log做相应的前滚或回滚,完成后会重建innodb logfile文件。

The --use-memory option The preparing process can be speed up by using more memory in it. It depends on the free or available RAM on your system, it defaults to 100MB. In general, the more memory available to the process,the better. The amount of memory used in the process can be specified by multiples of bytes:

恢复期间,--use-memory选项可以加速prepare过程,如果系统可用内存够大的话,该值缺省被设置为100MB。

Innobackupex恢复示意图

b0633f1c929c8ccf90a0d471d2ec9c10.png

二、  全备恢复流程

1. 当前环境

mysql> show variables like 'version';

+---------------+------------+

| Variable_name | Value |

+---------------+-----

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值