当前位置:   article > 正文

percona xtrabackup 之三 restore、recovery_怎么看xtrabackup的进度

怎么看xtrabackup的进度

os: centos 7.4.1708
db: mysql 8.0.20

Usage: [xtrabackup [--defaults-file=#] --backup | xtrabackup [--defaults-file=#] --prepare] [OPTIONS]

  • 1
  • 2
--prepare

  • 1
  • 2

准备数据恢复
–prepare prepare a backup for starting mysql server on the backup.
The --prepare step makes the files perfectly consistent at a single instant in time, so you can run InnoDB on them.

--apply-log-only

  • 1
  • 2

不回滚事务

–apply-log-only stop recovery process not to progress LSN after applying log when prepare.
–apply-log-only should be used when merging all incrementals except the last one. Even if the --apply-log-only was used on the last step, backup would still be consistent but in that case server would perform the rollback phase.

全量恢复(base)

# 一次 prepare 全量备份
# xtrabackup --defaults-file="/etc/mysql/my.cnf" --prepare --datadir=/var/lib/mysql --target-dir=/backup/backupset/20180327_base

  • 1
  • 2
  • 3

增量恢复(pitr)

前面恢复时需要增加 --apply-log-only ,阻止发生 rollback
最后一次恢复时,去除 --apply-log-only ,进行数据的回滚操作。

# 先 prepare 全量备份
# xtrabackup --defaults-file="/etc/mysql/my.cnf" --prepare --apply-log-only --target-dir=/backup/backupset/20180327_base

# 再 prepare 增量备份
# xtrabackup --defaults-file="/etc/mysql/my.cnf" --prepare --apply-log-only --target-dir=/backup/backupset/20180327_base --incremental-dir=/backup/backupset/20180327_inc1

# 再 prepare 全量备份
# xtrabackup --defaults-file="/etc/mysql/my.cnf" --prepare --target-dir=/backup/backupset/20180327_base

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

拷贝文件

# xtrabackup --copy-back --datadir=/var/lib/mysql --target-dir=/backup/backupset/20180327_base 

# chown -R mysql:mysql /var/lib/mysql/*

# systemctl start mysqld.service

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

参考:
https://docs.percona.com/percona-xtrabackup/2.4/howtos/recipes_xbk_full.html
https://docs.percona.com/percona-xtrabackup/2.4/howtos/recipes_xbk_inc.html
https://docs.percona.com/percona-xtrabackup/2.4/howtos/recipes_xbk_restore.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/522282
推荐阅读
相关标签
  

闽ICP备14008679号