XtraBackup 使用总结_为什么解后xtrabackup_info,2024年最新整理出软件测试逆向系列学习进阶视频

| 55 | E |
±-----±-----+
rows in set (0.00 sec)

测试备份

root@ha1:~# innobackupex --user=root --password=123456 --host=127.0.0.1 --defaults-file=/etc/my.cnf --databases=xtra_test /home/lgc/xtrabackup/

InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.

This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.

Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
11:56:58 innobackupex: Connecting to MySQL server with DSN ‘dbi:mysql:;mysql_read_default_file=/etc/mysql/my.cnf;mysql_read_default_group=xtrabackup;host=192.168.200.51’ as ‘zjy’ (using password: YES).
11:56:58 innobackupex: Connected to MySQL server
11:56:58 innobackupex: Executing a version check against the server…
11:56:58 innobackupex: Done.
11:56:58 innobackupex: Starting the backup operation

IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints “completed OK!”.

innobackupex: Using server version 5.5.38-0ubuntu0.12.04.1-log

innobackupex: Created backup directory /home/zhoujy/xtrabackup/2014-11-11_11-56-58
11:56:58 innobackupex: Starting ibbackup with command: xtrabackup --defaults-file=“/etc/mysql/my.cnf” --defaults-group=“mysqld” --backup --suspend-at-end --target-dir=/home/zhoujy/xtrabackup/2014-11-11_11-56-58 --innodb_log_file_size=“5242880” --innodb_data_file_path=“ibdata1:10M:autoextend” --tmpdir=/tmp --extra-lsndir=‘/tmp’ --databases=‘xtra_test’
innobackupex: Waiting for ibbackup (pid=10539) to suspend
innobackupex: Suspend file ‘/home/zhoujy/xtrabackup/2014-11-11_11-56-58/xtrabackup_suspended_2’

xtrabackup version 2.2.6 based on MySQL server 5.6.21 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 5242880

log scanned up to (7363097930)
xtrabackup: Generating a list of tablespaces
[01] Copying ./ibdata1 to /home/zhoujy/xtrabackup/2014-11-11_11-56-58/ibdata1
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
log scanned up to (7363097930)
[01] …done
log scanned up to (7363097930)
xtrabackup: Creating suspend file ‘/home/zhoujy/xtrabackup/2014-11-11_11-56-58/xtrabackup_suspended_2’ with pid ‘10540’
11:57:11 innobackupex: Continuing after ibbackup has suspended
11:57:11 innobackupex: Executing FLUSH TABLES WITH READ LOCK…
11:57:11 innobackupex: All tables locked and flushed to disk
11:57:11 innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of ‘/var/lib/mysql/’
innobackupex: Backing up file ‘/var/lib/mysql//xtra_test/db.opt’
innobackupex: Backing up file ‘/var/lib/mysql//xtra_test/M.MYI’
log scanned up to (7363097930)
innobackupex: Backing up file ‘/var/lib/mysql//xtra_test/M.frm’
innobackupex: Backing up file ‘/var/lib/mysql//xtra_test/I.frm’
innobackupex: Backing up file ‘/var/lib/mysql//xtra_test/M.MYD’
11:57:11 innobackupex: Finished backing up non-InnoDB tables and files
11:57:11 innobackupex: Executing FLUSH ENGINE LOGS…
11:57:11 innobackupex: Waiting for log copying to finish

xtrabackup: The latest check point (for incremental): ‘7363097930’
xtrabackup: Stopping log copying thread.
.>> log scanned up to (7363097930)

xtrabackup: Creating suspend file ‘/home/zhoujy/xtrabackup/2014-11-11_11-56-58/xtrabackup_log_copied’ with pid ‘10540’
xtrabackup: Transaction log of lsn (7363097930) to (7363097930) was copied.
11:57:12 innobackupex: All tables unlocked

innobackupex: Backup created in directory ‘/home/zhoujy/xtrabackup/2014-11-11_11-56-58’
innobackupex: MySQL binlog position: filename ‘mysql-bin51.000001’, position 967
11:57:12 innobackupex: Connection to database server closed
11:57:12 innobackupex: completed OK!

查看备份文件:

ls -lh 2014-11-11_11-56-58/
total 1.2G
-rw-r–r-- 1 root root 188 11月 11 11:56 backup-my.cnf
-rw-r----- 1 root root 1.2G 11月 11 11:57 ibdata1
-rw-r–r-- 1 root root 25 11月 11 11:57 xtrabackup_binlog_info
-rw-r----- 1 root root 95 11月 11 11:57 xtrabackup_checkpoints
-rw-r–r-- 1 root root 666 11月 11 11:57 xtrabackup_info
-rw-r----- 1 root root 2.5K 11月 11 11:57 xtrabackup_logfile
drwxr-xr-x 2 root root 4.0K 11月 11 11:57 xtra_test

/home/zhoujy/xtrabackup/ 备份存放的位置,备份会在该目录下生成一个按照时间命名的文件夹。用**–no-timestamp**参数可以指定到自己想要的备份文件夹,不受时间命名的文件夹限制。

利用 --apply-log的作用是通过回滚未提交的事务及同步已经提交的事务至数据文件使数据文件处于一致性状态。

root@localhost:/home/lgc/xtrabackup# innobackupex --apply-log /home/lgc/xtrabackup/2014-11-11_11-56-58/

应用完之后再查看备份文件看是否有变化:

root@localhost:/home/lgc/xtrabackup# ls -lh 2014-11-11_11-56-58/
total 1.2G
-rw-r–r-- 1 root root 188 11月 11 11:56 backup-my.cnf
-rw-r----- 1 root root 1.2G 11月 11 12:02 ibdata1
-rw-r–r-- 1 root root 5.0M 11月 11 12:02 ib_logfile0
-rw-r–r-- 1 root root 5.0M 11月 11 12:02 ib_logfile1
-rw-r–r-- 1 root root 25 11月 11 11:57 xtrabackup_binlog_info
-rw-r–r-- 1 root root 38 11月 11 12:02 xtrabackup_binlog_pos_innodb
-rw-r----- 1 root root 95 11月 11 12:02 xtrabackup_checkpoints
-rw-r–r-- 1 root root 666 11月 11 11:57 xtrabackup_info
-rw-r----- 1 root root 2.0M 11月 11 12:02 xtrabackup_logfile
drwxr-xr-x 2 root root 4.0K 11月 11 11:57 xtra_test

看到redo log已经出现。xtrabackup_开头的几个文件记录了一些日志偏移量的信息和日志名和时间等信息。在xtrabackup_checkpoints中记录了备份的模式:

backup_type = full-backuped。

xtrabackup_binlog_info:记录当前最新的LOG Position
xtrabackup_binlog_pos_innodb:innodb log postion
xtrabackup_checkpoints: 存放备份的起始位置beginlsn和结束位置endlsn,增量备份需要这个lsn[增量备份可以在这里面看from和to两个值的变化
xtrabackup_info:备份的一些具体信息日志

增量备份

在做增量备份的时候需要做一次全量备份,只是针对所有库的备份:

root@localhost:/home/lgc/xtrabackup# innobackupex --apply-log /home/lgc/xtrabackup/2014-11-11_11-56-58/

操作数据库,新增数据或删除数据,保证测试有效性。

mysql> insert into X values(‘dxy’);
Query OK, 1 row affected (0.01 sec)

mysql> insert into X values(‘浙江’);
Query OK, 1 row affected (0.01 sec)

基于全量增备:

innobackupex --user=lgc --password=123456 --host=127.0.01 --defaults-file=/etc/my.cnf --incremental --incremental-basedir=/home/lgc/xtrabackup/2014-11-11_13-57-11/ /home/zhoujy/increment_data/

其中,–incremental指明是增量备份,–incremental-basedir指定上次完整备份或者增量备份文件的位置。这里的增量备份其实只针对的是InnoDB,对于MyISAM来说,还是完整备份。

基于增量的增备:

就是–incremental-basedir 指定增量备份文件的位置,此时如需还原,则须还原2次。

#还原全量备份:
root@localhost:/home/lgc# innobackupex --apply-log /home/lgc/xtrabackup/2014-11-11_13-57-11/

#第一次的增量备份应用日志,应用完日志后,将合并到全备上,恢复使用全备恢复
root@localhost:~# innobackupex --apply-log /home/lgc/xtrabackup/2014-11-11_13-57-11/ --incremental-dir=/home/lgc/increment_data/2014-11-11_14-14-56/

#第二次的增量备份应用日志,应用完日志后,将合并到全备上,恢复使用全备恢复
root@localhost:~# innobackupex --apply-log /home/lgc/xtrabackup/2014-11-11_13-57-11/ --incremental-dir=/home/lgc/increment_data/2014-11-11_14-25-36/

此时两次增量备份其实都合并到全备上了,恢复是只需要使用全备进行恢复就可以了

压缩备份:必须使用-i参数拆包解压

打包(Tar)备份
innobackupex --user=root–password=123456 --host=127.0.0.1 --defaults-file=/etc/my.cnf --databases=xtra_test --stream=tar /home/lgc/xtrabackup/ 1>/home/lgc/xtrabackup/xtra_test.tar

但有可能出错,(表示:使用tar格式远程增量备份时收到如下提示,即只支持xbstream),如下提示:

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数软件测试工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年软件测试全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上软件测试开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注软件测试)
img

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注软件测试)
[外链图片转存中…(img-1Wnn0Xyx-1712994388620)]

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值