MySQL冷备、mysqldump、MySQL热拷贝都无法实现对数据库进行增量备份。在实际生产环境中增量备份是非常实用的,如果数据大于50G或100G,存储空间足够的情况下,可以每天进行完整备份,如果每天产生的数据量较大,需要定制数据备份策略。例如每周实用完整备份,周一到周六实用增量备份。而Percona-Xtrabackup就是为了实现增量备份而出现的一款主流备份工具。
Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。它能对InnoDB和XtraDB存储引擎的数据库非阻塞地备份(对于MyISAM的备份同样需要加表锁)。XtraBackup支持所有的Percona Server、MySQL、MariaDB和Drizzle。
xtrabackup有两个主要的工具:xtrabackup、innobackupex
xtrabackup -- 只能备份InnoDB和XtraDB两种数据表
innobackupex -- 则封装了xtrabackup,同时可以备份MyISAM数据表
Innobackupex完整备份后生成几个重要文件
文件 | 文件用途 |
---|---|
xtrabackup_binlog_info | 记录当前最新的LOG Position,在备份的那一刻服务器二进制所处的位置,通过SHOW MASTER STATUS获取 |
xtrabackup_binlog_pos_innodb | InnoDB表或XtraDB当前所处的二进制位置,与InnoDB事务相关 |
xtrabackup_checkpoints | 存放备份的起始位置beginlsn和结束位置endlsn,增量备份需要这个lsn[增量备份可以在这里面看from和to两个值的变化] |
xtrabackup_logfile | 在备份过程中拷贝的事务日志,用于预还原 |
在InnoDB内部会维护一个redo日志文件,我们也可以叫做事务日志文件。事务日志会存储每一个InnoDB表数据的记录修改。当InnoDB启动时,InnoDB会检查数据文件和事务日志,并执行两个步骤:它应用(前滚)已经提交的事务日志到数据文件,并将修改过但没有提交的数据进行回滚操作。
使用xtrabackup进行还原,需要xtrabackup进行”备份”和”准备”:先将文件全部复制过来,再根据事务日志对部分操作进行回滚,如下描述:
xtrabackup的备份过程。Xtrabackup在启动时会记住log sequence number(LSN),并且复制所有的数据文件。复制过程需要一些时间,所以这期间如果数据文件有改动,那么将会使数据库处于一个不同的时间点。所以,xtrabackup会运行一个后台进程,用于监视事务日志,并从事务日志复制最新的修改。Xtrabackup持续地做这个操作,这些数据改动会写入xtrabackup_logfile文件。xtrabackup自启动开始,就不停的将事务日志中每个数据文件的修改都记录下来。
接下来是准备(prepare)过程。在这个过程中,xtrabackup使用之前复制的事务日志,对各个数据文件执行灾难恢复(就像mysql刚启动时要做的一样)。当这个过程结束后,数据库就可以做恢复还原了。
比较详细的过程
1. 调用xtrabackup对innodb表空间文件(这一瞬间的映像Time1)备份,而在这个innodb表备份期间数据库是不加锁的,外部可以继续往库里增减数据(这才能叫热备份)。而在Time1和Time2这两个时间点之间的改动由一个线程不断地扫innodb log获得(ChangeSet1),一旦发现redo中有新的日志写入,立刻将日志记入后台日志文件xtrabackup_log中
2. 锁所有库。
3. 以直接拷贝的方式备份frm,MYD,MYI,MRG,TRG,TRN,opt格式的文件。
4. 步骤3中的数据备份完毕时(Time2),停止扫innodb log的线程,把ChangeSet1的数据拷贝到备份中。
5. 解锁所有库。
6. 终止挂起,备份完毕。
注意要点
1.根据innobackupex的原理可知它不是真正的热备份,MyISAM表越少越小就越有利。要利用Xtrabackup的好处就尽量用innodb表。
2.还原备份前关闭mysql服务;还原备份后检查数据文件权限是否正确。
redhat6的版本,使用2.3.4这个版本
此链接下载:https://www.percona.com/downloads/Percona-XtraBackup-2.3/Percona-XtraBackup-2.3.4/binary/redhat/6/x86_64/percona-xtrabackup-2.3.4-1.el6.x86_64.rpm
Xtrabackup包依赖于epel源一些工具包,所以使用yum安装。
yum install percona-xtrabackup-2.3.4-1.el6.x86_64.rpm
-- 如果有如下报错
Error: Package: percona-xtrabackup-2.3.4-1.el6.x86_64 Requires: libev.so.4()(64bit)
-- 下载文件
wget ftp://rpmfind.net/linux/atrpms/el6-x86_64/atrpms/stable/libev-4.04-2.el6.x86_64.rpm
rpm -ivh libev-4.04-2.el6.x86_64.rpm
安装完后的目录结构如下,有4个可执行文件
usr
├── bin
│ ├── innobackupex
│ ├── xbcrypt
│ ├── xbstream
│ └── xtrabackup
其中最主要的是 innobackupex 和 xtrabackup,前者是一个 perl 脚本,后者是 C/C++ 编译的二进制。
xbcrypt 是加解密用的;xbstream 类似于tar
参数名 | 参数用途 |
---|---|
–host | 指定主机 |
–user | 指定用户名 |
–password | 指定密码 |
–port | 指定端口 |
–databases | 指定数据库 |
–incremental | 创建增量备份 |
–incremental-basedir | 指定包含完全备份的目录 |
–incremental-dir | 指定包含增量备份的目录 |
–apply-log | 对备份进行预处理操作 一般情况下,在备份完成后,数据尚且不能用于恢复操作, 因为备份的数据中可能会包含尚未提交的事务或已经提交但尚未同步至数据文件中的事务。 因此,此时数据文件仍处理不一致状态。 “准备”的主要作用正是通过回滚未提交的事务及同步已经提交的事务 至数据文件也使得数据文件处于一致性状态。 |
–redo-only | 不回滚未提交事务 |
–copy-back | 恢复备份目录 |
测试数据准备:
create database test;
use test;
create table t1(id int,name varchar(1000));
DELIMITER //
CREATE PROCEDURE p5()
BEGIN
declare l_n1 int default 10000000;
while l_n1 > 0 DO
insert into t1 select l_n1,repeat('w',1000);
set l_n1 = l_n1 - 1;
end while;
select l_n1;
END;
//
DELIMITER ;
-- 往测试表录入1000w条数据,执行时间比较长,可以优化下,分批提交
call p5;
--拷贝一个表t2
create table t2 as select * from t1;
-- 全备语句
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock /data/backup/
执行日志:
[root@monitor software]# innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock /data/backup/
200815 23:36:41 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!".
200815 23:36:41 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/var/lib/mysql/mysql.sock' as 'root' (using password: NO).
200815 23:36:41 version_check Connected to MySQL server
200815 23:36:41 version_check Executing a version check against the server...
200815 23:36:41 version_check Done.
200815 23:36:41 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: /var/lib/mysql/mysql.sock
Using server version 5.6.49
innobackupex version 2.3.4 based on MySQL server 5.6.24 Linux (x86_64) (revision id: e80c779)
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:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
200815 23:36:41 >> log scanned up to (6370769454)
xtrabackup: Generating a list of tablespaces
200815 23:36:42 [01] Copying ./ibdata1 to /data/backup//2020-08-15_23-36-41/ibdata1
200815 23:36:42 >> log scanned up to (6370769454)
200815 23:36:43 >> log scanned up to (6370769454)
200815 23:36:44 [01] ...done
200815 23:36:44 [01] Copying ./test/t2.ibd to /data/backup//2020-08-15_23-36-41/test/t2.ibd
200815 23:36:44 >> log scanned up to (6370769454)
200815 23:36:45 >> log scanned up to (6370769454)
200815 23:36:46 >> log scanned up to (6370769454)
200815 23:36:47 >> log scanned up to (6370769454)
200815 23:36:48 >> log scanned up to (6370769454)
200815 23:36:49 >> log scanned up to (6370769454)
200815 23:36:50 >> log scanned up to (6370769454)
200815 23:36:51 >> log scanned up to (6370769454)
200815 23:36:52 >> log scanned up to (6370769454)
200815 23:36:53 >> log scanned up to (6370769454)
200815 23:36:54 >> log scanned up to (6370769454)
200815 23:36:55 >> log scanned up to (6370769454)
200815 23:36:56 >> log scanned up to (6370769454)
200815 23:36:57 >> log scanned up to (6370769454)
200815 23:36:58 >> log scanned up to (6370769454)
200815 23:36:59 >> log scanned up to (6370769454)
200815 23:37:00 >> log scanned up to (6370769454)
200815 23:37:01 >> log scanned up to (6370769454)
200815 23:37:02 >> log scanned up to (6370769454)
200815 23:37:03 >> log scanned up to (6370769454)
200815 23:37:05 >> log scanned up to (6370769454)
200815 23:37:06 >> log scanned up to (6370769454)
200815 23:37:07 >> log scanned up to (6370769454)
200815 23:37:08 >> log scanned up to (6370769454)
200815 23:37:09 >> log scanned up to (6370769454)
200815 23:37:10 >> log scanned up to (6370769454)
200815 23:37:11 >> log scanned up to (6370769454)
200815 23:37:12 >> log scanned up to (6370769454)
200815 23:37:13 >> log scanned up to (6370769454)
200815 23:37:14 >> log scanned up to (6370769454)
200815 23:37:15 >> log scanned up to (6370769454)
200815 23:37:16 >> log scanned up to (6370769454)
200815 23:37:17 >> log scanned up to (6370769454)
200815 23:37:18 >> log scanned up to (6370769454)
200815 23:37:19 >> log scanned up to (6370769454)
200815 23:37:20 >> log scanned up to (6370769454)
200815 23:37:21 >> log scanned up to (6370769454)
200815 23:37:22 >> log scanned up to (6370769454)
200815 23:37:23 >> log scanned up to (6370769454)
200815 23:37:24 >> log scanned up to (6370769454)
200815 23:37:25 >> log scanned up to (6370769454)
200815 23:37:26 >> log scanned up to (6370769454)
200815 23:37:27 >> log scanned up to (6370769454)
200815 23:37:28 >> log scanned up to (6370769454)
200815 23:37:29 >> log scanned up to (6370769454)
200815 23:37:30 >> log scanned up to (6370769454)
200815 23:37:31 >> log scanned up to (6370769454)
200815 23:37:32 >> log scanned up to (6370769454)
200815 23:37:33 >> log scanned up to (6370769454)
200815 23:37:34 >> log scanned up to (6370769454)
200815 23:37:35 >> log scanned up to (6370769454)
200815 23:37:36 >> log scanned up to (6370769454)
200815 23:37:37 >> log scanned up to (6370769454)
200815 23:37:38 >> log scanned up to (6370769454)
200815 23:37:39 >> log scanned up to (6370769454)
200815 23:37:40 >> log scanned up to (6370769454)
200815 23:37:41 >> log scanned up to (6370769454)
200815 23:37:42 >> log scanned up to (6370769454)
200815 23:37:43 >> log scanned up to (6370769454)
200815 23:37:44 >> log scanned up to (6370769454)
200815 23:37:45 >> log scanned up to (6370769454)
200815 23:37:46 >> log scanned up to (6370769454)
200815 23:37:47 >> log scanned up to (6370769454)
200815 23:37:48 >> log scanned up to (6370769454)
200815 23:37:49 >> log scanned up to (6370769454)
200815 23:37:50 >> log scanned up to (6370769454)
200815 23:37:51 >> log scanned up to (6370769454)
200815 23:37:52 >> log scanned up to (6370769454)
200815 23:37:53 >> log scanned up to (6370769454)
200815 23:37:54 >> log scanned up to (6370769454)
200815 23:37:55 >> log scanned up to (6370769454)
200815 23:37:56 >> log scanned up to (6370769454)
200815 23:37:57 >> log scanned up to (6370769454)
200815 23:37:58 >> log scanned up to (6370769454)
200815 23:37:59 >> log scanned up to (6370769454)
200815 23:38:00 >> log scanned up to (6370769454)
200815 23:38:01 >> log scanned up to (6370769454)
200815 23:38:02 >> log scanned up to (6370769454)
200815 23:38:03 >> log scanned up to (6370769454)
200815 23:38:04 >> log scanned up to (6370769454)
200815 23:38:05 [01] ...done
200815 23:38:05 [01] Copying ./test/t1.ibd to /data/backup//2020-08-15_23-36-41/test/t1.ibd
200815 23:38:05 >> log scanned up to (6370769454)
200815 23:38:06 >> log scanned up to (6370769454)
200815 23:38:07 >> log scanned up to (6370769454)
200815 23:38:08 >> log scanned up to (6370769454)
200815 23:38:09 >> log scanned up to (6370769454)
200815 23:38:10 >> log scanned up to (6370769454)
200815 23:38:11 >> log scanned up to (6370769454)
200815 23:38:12 >> log scanned up to (6370769454)
200815 23:38:14 >> log scanned up to (6370769454)
200815 23:38:15 >> log scanned up to (6370769454)
200815 23:38:16 >> log scanned up to (6370769454)
200815 23:38:17 >> log scanned up to (6370769454)
200815 23:38:18 >> log scanned up to (6370769454)
200815 23:38:19 >> log scanned up to (6370769454)
200815 23:38:20 >> log scanned up to (6370769454)
200815 23:38:21 >> log scanned up to (6370769454)
200815 23:38:22 >> log scanned up to (6370769454)
200815 23:38:23 >> log scanned up to (6370769454)
200815 23:38:24 >> log scanned up to (6370769454)
200815 23:38:25 >> log scanned up to (6370769454)
200815 23:38:26 >> log scanned up to (6370769454)
200815 23:38:27 >> log scanned up to (6370769454)
200815 23:38:28 >> log scanned up to (6370769454)
200815 23:38:29 >> log scanned up to (6370769454)
200815 23:38:30 >> log scanned up to (6370769454)
200815 23:38:31 >> log scanned up to (6370769454)
200815 23:38:32 >> log scanned up to (6370769454)
200815 23:38:33 >> log scanned up to (6370769454)
200815 23:38:34 >> log scanned up to (6370769454)
200815 23:38:35 >> log scanned up to (6370769454)
200815 23:38:36 >> log scanned up to (6370769454)
200815 23:38:37 >> log scanned up to (6370769454)
200815 23:38:38 >> log scanned up to (6370769454)
200815 23:38:39 >> log scanned up to (6370769454)
200815 23:38:40 >> log scanned up to (6370769454)
200815 23:38:41 >> log scanned up to (6370769454)
200815 23:38:42 >> log scanned up to (6370769454)
200815 23:38:43 >> log scanned up to (6370769454)
200815 23:38:44 >> log scanned up to (6370769454)
200815 23:38:45 >> log scanned up to (6370769454)
200815 23:38:46 >> log scanned up to (6370769454)
200815 23:38:47 >> log scanned up to (6370769454)
200815 23:38:48 >> log scanned up to (6370769454)
200815 23:38:49 >> log scanned up to (6370769454)
200815 23:38:50 >> log scanned up to (6370769454)
200815 23:38:51 >> log scanned up to (6370769454)
200815 23:38:52 >> log scanned up to (6370769454)
200815 23:38:53 >> log scanned up to (6370769454)
200815 23:38:54 >> log scanned up to (6370769454)
200815 23:38:55 >> log scanned up to (6370769454)
200815 23:38:56 >> log scanned up to (6370769454)
200815 23:38:57 >> log scanned up to (6370769454)
200815 23:38:58 >> log scanned up to (6370769454)
200815 23:38:59 >> log scanned up to (6370769454)
200815 23:39:00 >> log scanned up to (6370769454)
200815 23:39:01 >> log scanned up to (6370769454)
200815 23:39:02 >> log scanned up to (6370769454)
200815 23:39:03 >> log scanned up to (6370769454)
200815 23:39:04 >> log scanned up to (6370769454)
200815 23:39:05 >> log scanned up to (6370769454)
200815 23:39:06 >> log scanned up to (6370769454)
200815 23:39:07 >> log scanned up to (6370769454)
200815 23:39:08 >> log scanned up to (6370769454)
200815 23:39:09 >> log scanned up to (6370769454)
200815 23:39:10 >> log scanned up to (6370769454)
200815 23:39:11 >> log scanned up to (6370769454)
200815 23:39:12 >> log scanned up to (6370769454)
200815 23:39:13 >> log scanned up to (6370769454)
200815 23:39:14 >> log scanned up to (6370769454)
200815 23:39:15 >> log scanned up to (6370769454)
200815 23:39:16 >> log scanned up to (6370769454)
200815 23:39:17 >> log scanned up to (6370769454)
200815 23:39:18 >> log scanned up to (6370769454)
200815 23:39:19 >> log scanned up to (6370769454)
200815 23:39:20 >> log scanned up to (6370769454)
200815 23:39:21 >> log scanned up to (6370769454)
200815 23:39:22 >> log scanned up to (6370769454)
200815 23:39:23 >> log scanned up to (6370769454)
200815 23:39:24 >> log scanned up to (6370769454)
200815 23:39:25 >> log scanned up to (6370769454)
200815 23:39:26 >> log scanned up to (6370769454)
200815 23:39:27 >> log scanned up to (6370769454)
200815 23:39:28 >> log scanned up to (6370769454)
200815 23:39:29 >> log scanned up to (6370769454)
200815 23:39:30 >> log scanned up to (6370769454)
200815 23:39:31 >> log scanned up to (6370769454)
200815 23:39:32 >> log scanned up to (6370769454)
200815 23:39:33 >> log scanned up to (6370769454)
200815 23:39:34 >> log scanned up to (6370769454)
200815 23:39:35 >> log scanned up to (6370769454)
200815 23:39:36 >> log scanned up to (6370769454)
200815 23:39:37 >> log scanned up to (6370769454)
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/slave_worker_info.ibd to /data/backup//2020-08-15_23-36-41/mysql/slave_worker_info.ibd
200815 23:39:38 >> log scanned up to (6370769454)
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/slave_relay_log_info.ibd to /data/backup//2020-08-15_23-36-41/mysql/slave_relay_log_info.ibd
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/innodb_index_stats.ibd to /data/backup//2020-08-15_23-36-41/mysql/innodb_index_stats.ibd
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/slave_master_info.ibd to /data/backup//2020-08-15_23-36-41/mysql/slave_master_info.ibd
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/innodb_table_stats.ibd to /data/backup//2020-08-15_23-36-41/mysql/innodb_table_stats.ibd
200815 23:39:38 [01] ...done
200815 23:39:38 Executing FLUSH NO_WRITE_TO_BINLOG TABLES...
200815 23:39:38 Executing FLUSH TABLES WITH READ LOCK...
200815 23:39:38 Starting to backup non-InnoDB tables and files
200815 23:39:38 [01] Copying ./test/t1.frm to /data/backup//2020-08-15_23-36-41/test/t1.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./test/db.opt to /data/backup//2020-08-15_23-36-41/test/db.opt
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./test/t2.frm to /data/backup//2020-08-15_23-36-41/test/t2.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/servers.MYD to /data/backup//2020-08-15_23-36-41/mysql/servers.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/time_zone_name.MYI to /data/backup//2020-08-15_23-36-41/mysql/time_zone_name.MYI
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/help_category.MYI to /data/backup//2020-08-15_23-36-41/mysql/help_category.MYI
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/time_zone_leap_second.MYD to /data/backup//2020-08-15_23-36-41/mysql/time_zone_leap_second.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/time_zone.frm to /data/backup//2020-08-15_23-36-41/mysql/time_zone.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/help_relation.MYI to /data/backup//2020-08-15_23-36-41/mysql/help_relation.MYI
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/help_category.frm to /data/backup//2020-08-15_23-36-41/mysql/help_category.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/general_log.frm to /data/backup//2020-08-15_23-36-41/mysql/general_log.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/innodb_table_stats.frm to /data/backup//2020-08-15_23-36-41/mysql/innodb_table_stats.frm
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/proxies_priv.MYI to /data/backup//2020-08-15_23-36-41/mysql/proxies_priv.MYI
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/time_zone_name.MYD to /data/backup//2020-08-15_23-36-41/mysql/time_zone_name.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/help_keyword.MYD to /data/backup//2020-08-15_23-36-41/mysql/help_keyword.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/proc.MYD to /data/backup//2020-08-15_23-36-41/mysql/proc.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/columns_priv.MYD to /data/backup//2020-08-15_23-36-41/mysql/columns_priv.MYD
200815 23:39:38 [01] ...done
200815 23:39:38 [01] Copying ./mysql/help_topic.frm to /data/backup//2020-08-15_23-36-41/mysql/help_topic.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/event.MYI to /data/backup//2020-08-15_23-36-41/mysql/event.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/event.MYD to /data/backup//2020-08-15_23-36-41/mysql/event.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/procs_priv.MYD to /data/backup//2020-08-15_23-36-41/mysql/procs_priv.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slow_log.CSV to /data/backup//2020-08-15_23-36-41/mysql/slow_log.CSV
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_leap_second.MYI to /data/backup//2020-08-15_23-36-41/mysql/time_zone_leap_second.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slave_relay_log_info.frm to /data/backup//2020-08-15_23-36-41/mysql/slave_relay_log_info.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_keyword.MYI to /data/backup//2020-08-15_23-36-41/mysql/help_keyword.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition_type.MYI to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition_type.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/procs_priv.frm to /data/backup//2020-08-15_23-36-41/mysql/procs_priv.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/columns_priv.MYI to /data/backup//2020-08-15_23-36-41/mysql/columns_priv.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/general_log.CSM to /data/backup//2020-08-15_23-36-41/mysql/general_log.CSM
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_relation.frm to /data/backup//2020-08-15_23-36-41/mysql/help_relation.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/plugin.MYI to /data/backup//2020-08-15_23-36-41/mysql/plugin.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/procs_priv.MYI to /data/backup//2020-08-15_23-36-41/mysql/procs_priv.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_name.frm to /data/backup//2020-08-15_23-36-41/mysql/time_zone_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/tables_priv.MYI to /data/backup//2020-08-15_23-36-41/mysql/tables_priv.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition.MYD to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/proc.frm to /data/backup//2020-08-15_23-36-41/mysql/proc.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/servers.frm to /data/backup//2020-08-15_23-36-41/mysql/servers.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_topic.MYI to /data/backup//2020-08-15_23-36-41/mysql/help_topic.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition.MYI to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/proxies_priv.frm to /data/backup//2020-08-15_23-36-41/mysql/proxies_priv.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slave_worker_info.frm to /data/backup//2020-08-15_23-36-41/mysql/slave_worker_info.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slave_master_info.frm to /data/backup//2020-08-15_23-36-41/mysql/slave_master_info.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/func.frm to /data/backup//2020-08-15_23-36-41/mysql/func.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/user.frm to /data/backup//2020-08-15_23-36-41/mysql/user.frm
200815 23:39:39 >> log scanned up to (6370769454)
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/plugin.MYD to /data/backup//2020-08-15_23-36-41/mysql/plugin.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/tables_priv.MYD to /data/backup//2020-08-15_23-36-41/mysql/tables_priv.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_leap_second.frm to /data/backup//2020-08-15_23-36-41/mysql/time_zone_leap_second.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition.frm to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/columns_priv.frm to /data/backup//2020-08-15_23-36-41/mysql/columns_priv.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/tables_priv.frm to /data/backup//2020-08-15_23-36-41/mysql/tables_priv.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/general_log.CSV to /data/backup//2020-08-15_23-36-41/mysql/general_log.CSV
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/ndb_binlog_index.frm to /data/backup//2020-08-15_23-36-41/mysql/ndb_binlog_index.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone.MYD to /data/backup//2020-08-15_23-36-41/mysql/time_zone.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition_type.MYD to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition_type.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/db.frm to /data/backup//2020-08-15_23-36-41/mysql/db.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/innodb_index_stats.frm to /data/backup//2020-08-15_23-36-41/mysql/innodb_index_stats.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone_transition_type.frm to /data/backup//2020-08-15_23-36-41/mysql/time_zone_transition_type.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_relation.MYD to /data/backup//2020-08-15_23-36-41/mysql/help_relation.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/user.MYI to /data/backup//2020-08-15_23-36-41/mysql/user.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/user.MYD to /data/backup//2020-08-15_23-36-41/mysql/user.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slow_log.CSM to /data/backup//2020-08-15_23-36-41/mysql/slow_log.CSM
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/time_zone.MYI to /data/backup//2020-08-15_23-36-41/mysql/time_zone.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_category.MYD to /data/backup//2020-08-15_23-36-41/mysql/help_category.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/ndb_binlog_index.MYD to /data/backup//2020-08-15_23-36-41/mysql/ndb_binlog_index.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/ndb_binlog_index.MYI to /data/backup//2020-08-15_23-36-41/mysql/ndb_binlog_index.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_topic.MYD to /data/backup//2020-08-15_23-36-41/mysql/help_topic.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/plugin.frm to /data/backup//2020-08-15_23-36-41/mysql/plugin.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/event.frm to /data/backup//2020-08-15_23-36-41/mysql/event.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/func.MYD to /data/backup//2020-08-15_23-36-41/mysql/func.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/help_keyword.frm to /data/backup//2020-08-15_23-36-41/mysql/help_keyword.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/proc.MYI to /data/backup//2020-08-15_23-36-41/mysql/proc.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/proxies_priv.MYD to /data/backup//2020-08-15_23-36-41/mysql/proxies_priv.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/slow_log.frm to /data/backup//2020-08-15_23-36-41/mysql/slow_log.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/servers.MYI to /data/backup//2020-08-15_23-36-41/mysql/servers.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/db.MYI to /data/backup//2020-08-15_23-36-41/mysql/db.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/func.MYI to /data/backup//2020-08-15_23-36-41/mysql/func.MYI
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./mysql/db.MYD to /data/backup//2020-08-15_23-36-41/mysql/db.MYD
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_summary_by_user_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_by_user_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_stages_summary_by_user_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_summary_by_user_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/host_cache.frm to /data/backup//2020-08-15_23-36-41/performance_schema/host_cache.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/users.frm to /data/backup//2020-08-15_23-36-41/performance_schema/users.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_summary_by_host_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_by_host_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/socket_instances.frm to /data/backup//2020-08-15_23-36-41/performance_schema/socket_instances.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_stages_current.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_current.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_summary_global_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_global_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/table_io_waits_summary_by_table.frm to /data/backup//2020-08-15_23-36-41/performance_schema/table_io_waits_summary_by_table.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_current.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_current.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_summary_by_instance.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_by_instance.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_summary_by_account_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_by_account_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_history.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_history.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_history.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_history.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_summary_by_host_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_by_host_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_stages_history.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_history.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/socket_summary_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/socket_summary_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/socket_summary_by_instance.frm to /data/backup//2020-08-15_23-36-41/performance_schema/socket_summary_by_instance.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/session_account_connect_attrs.frm to /data/backup//2020-08-15_23-36-41/performance_schema/session_account_connect_attrs.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/file_instances.frm to /data/backup//2020-08-15_23-36-41/performance_schema/file_instances.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/objects_summary_global_by_type.frm to /data/backup//2020-08-15_23-36-41/performance_schema/objects_summary_global_by_type.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_history_long.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_history_long.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_summary_by_thread_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_by_thread_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_stages_history_long.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_history_long.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_current.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_current.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_summary_by_account_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_by_account_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/table_io_waits_summary_by_index_usage.frm to /data/backup//2020-08-15_23-36-41/performance_schema/table_io_waits_summary_by_index_usage.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/accounts.frm to /data/backup//2020-08-15_23-36-41/performance_schema/accounts.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/hosts.frm to /data/backup//2020-08-15_23-36-41/performance_schema/hosts.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_summary_by_digest.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_by_digest.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_waits_history_long.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_history_long.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/events_statements_summary_by_thread_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_by_thread_by_event_name.frm
200815 23:39:39 [01] ...done
200815 23:39:39 [01] Copying ./performance_schema/table_lock_waits_summary_by_table.frm to /data/backup//2020-08-15_23-36-41/performance_schema/table_lock_waits_summary_by_table.frm
200815 23:39:39 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_statements_summary_global_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_statements_summary_global_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_stages_summary_by_thread_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_summary_by_thread_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/db.opt to /data/backup//2020-08-15_23-36-41/performance_schema/db.opt
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/setup_objects.frm to /data/backup//2020-08-15_23-36-41/performance_schema/setup_objects.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/rwlock_instances.frm to /data/backup//2020-08-15_23-36-41/performance_schema/rwlock_instances.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/setup_instruments.frm to /data/backup//2020-08-15_23-36-41/performance_schema/setup_instruments.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/setup_timers.frm to /data/backup//2020-08-15_23-36-41/performance_schema/setup_timers.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_stages_summary_by_account_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_summary_by_account_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/performance_timers.frm to /data/backup//2020-08-15_23-36-41/performance_schema/performance_timers.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/session_connect_attrs.frm to /data/backup//2020-08-15_23-36-41/performance_schema/session_connect_attrs.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/cond_instances.frm to /data/backup//2020-08-15_23-36-41/performance_schema/cond_instances.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_stages_summary_global_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_summary_global_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/mutex_instances.frm to /data/backup//2020-08-15_23-36-41/performance_schema/mutex_instances.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/setup_actors.frm to /data/backup//2020-08-15_23-36-41/performance_schema/setup_actors.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/file_summary_by_instance.frm to /data/backup//2020-08-15_23-36-41/performance_schema/file_summary_by_instance.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_waits_summary_by_user_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_waits_summary_by_user_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/file_summary_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/file_summary_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/events_stages_summary_by_host_by_event_name.frm to /data/backup//2020-08-15_23-36-41/performance_schema/events_stages_summary_by_host_by_event_name.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/threads.frm to /data/backup//2020-08-15_23-36-41/performance_schema/threads.frm
200815 23:39:40 [01] ...done
200815 23:39:40 [01] Copying ./performance_schema/setup_consumers.frm to /data/backup//2020-08-15_23-36-41/performance_schema/setup_consumers.frm
200815 23:39:40 [01] ...done
200815 23:39:40 Finished backing up non-InnoDB tables and files
200815 23:39:40 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
xtrabackup: The latest check point (for incremental): '6370769454'
xtrabackup: Stopping log copying thread.
.200815 23:39:40 >> log scanned up to (6370769454)
200815 23:39:40 Executing UNLOCK TABLES
200815 23:39:40 All tables unlocked
200815 23:39:40 Backup created in directory '/data/backup//2020-08-15_23-36-41'
200815 23:39:40 [00] Writing backup-my.cnf
200815 23:39:40 [00] ...done
200815 23:39:40 [00] Writing xtrabackup_info
200815 23:39:40 [00] ...done
xtrabackup: Transaction log of lsn (6370769454) to (6370769454) was copied.
200815 23:39:40 completed OK!
可以看到备份到自动命令的文件夹中
[root@monitor software]# cd /data/backup/
[root@monitor backup]# ls
2020-08-15_23-36-41
-- 备份文件都自定在 /data/backup/backup_dir 目录
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --no-timestamp /data/backup/backup_dir
可以看到备份都到指定目录中了
[root@monitor software]# cd /data/backup/
[root@monitor backup]# ls
backup_dir
[root@monitor backup]#
[root@monitor backup]#
[root@monitor backup]#
[root@monitor backup]# cd backup_dir/
[root@monitor backup_dir]# ls -lrt
total 77852
-rw-r-----. 1 root root 79691776 Aug 15 23:42 ibdata1
drwx------. 2 root root 4096 Aug 15 23:45 test
drwx------. 2 root root 4096 Aug 15 23:45 mysql
drwx------. 2 root root 4096 Aug 15 23:45 performance_schema
-rw-r-----. 1 root root 2560 Aug 15 23:45 xtrabackup_logfile
-rw-r-----. 1 root root 119 Aug 15 23:45 xtrabackup_checkpoints
-rw-r-----. 1 root root 387 Aug 15 23:45 backup-my.cnf
-rw-r-----. 1 root root 513 Aug 15 23:45 xtrabackup_info
–stream=tar 参数的使用,该选项表示流式备份的格式,backup完成之后以指定格式到STDOUT,目前只支持tar和xbstream。
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --stream=tar --no-timestamp /data/backup 1>/data/backup/xtra_backup20200815.tar
1> 代表标准输出(stdout),前面不加1,只是>,一样的效果
2> 代表标准错误(stderr)
-- 备份test和test1两个数据库
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --databases="test test1" --no-timestamp /data/backup/backup_database
备份完成的文件
[root@monitor backup_database]# pwd
/data/backup/backup_database
[root@monitor backup_database]# ls -lrth
total 77M
-rw-r-----. 1 root root 76M Aug 16 00:06 ibdata1
drwx------. 2 root root 4.0K Aug 16 00:09 test1
drwx------. 2 root root 4.0K Aug 16 00:09 test
-rw-r-----. 1 root root 2.5K Aug 16 00:09 xtrabackup_logfile
-rw-r-----. 1 root root 119 Aug 16 00:09 xtrabackup_checkpoints
-rw-r-----. 1 root root 387 Aug 16 00:09 backup-my.cnf
-rw-r-----. 1 root root 541 Aug 16 00:09 xtrabackup_info
备份场景1:备份不同库下的不同表,还是使用–databases参数,指定到表
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --databases="test.t1 test1.zqs" --no-timestamp /data/backup/backup_tables
备份场景2:备份一个库下的表,备份test库下t开头的表
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --include="test.t" --no-timestamp /data/backup/backup_tables
使用–incremental-basedir和–incremental参数来进行增量备份
-- 全量脚本
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --no-timestamp /data/backup/backup_dir
-- 增量脚本
innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --no-timestamp --incremental-basedir=/data/backup/backup_dir --incremental /data/backup/increment_data/
–incremental-basedir:全量备份目录
–incremental:增量备份目录
注:全量备份的目录是:/data/backup/backup_dir
[root@monitor backup]# innobackupex --defaults-file=/etc/my.cnf --user=root --password= --socket=/var/lib/mysql/mysql.sock --no-timestamp --incremental-basedir=/data/backup/backup_dir --incremental /data/backup/increment_data/
200816 00:23:46 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!".
200816 00:23:46 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/var/lib/mysql/mysql.sock' as 'root' (using password: NO).
200816 00:23:46 version_check Connected to MySQL server
200816 00:23:46 version_check Executing a version check against the server...
200816 00:23:46 version_check Done.
200816 00:23:46 Connecting to MySQL server host: localhost, user: root, password: set, port: 0, socket: /var/lib/mysql/mysql.sock
Using server version 5.6.49
innobackupex version 2.3.4 based on MySQL server 5.6.24 Linux (x86_64) (revision id: e80c779)
incremental backup from 6370773208 is enabled.
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:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
200816 00:23:46 >> log scanned up to (6370778259)
xtrabackup: Generating a list of tablespaces
xtrabackup: using the full scan for incremental backup
200816 00:23:47 [01] Copying ./ibdata1 to /data/backup/increment_data/ibdata1.delta
200816 00:23:47 >> log scanned up to (6370778259)
200816 00:23:48 [01] ...done
200816 00:23:48 [01] Copying ./test1/zqs.ibd to /data/backup/increment_data/test1/zqs.ibd.delta
200816 00:23:48 [01] ...done
200816 00:23:48 [01] Copying ./test/t2.ibd to /data/backup/increment_data/test/t2.ibd.delta
200816 00:23:48 >> log scanned up to (6370778259)
200816 00:23:49 >> log scanned up to (6370778259)
200816 00:23:50 >> log scanned up to (6370778259)
200816 00:23:51 >> log scanned up to (6370778259)
200816 00:23:52 >> log scanned up to (6370778259)
200816 00:23:53 >> log scanned up to (6370778259)
200816 00:23:54 >> log scanned up to (6370778259)
200816 00:23:55 >> log scanned up to (6370778259)
200816 00:23:56 >> log scanned up to (6370778259)
200816 00:23:57 >> log scanned up to (6370778259)
200816 00:23:58 >> log scanned up to (6370778259)
200816 00:23:59 >> log scanned up to (6370778259)
200816 00:24:00 >> log scanned up to (6370778259)
200816 00:24:01 >> log scanned up to (6370778259)
200816 00:24:02 >> log scanned up to (6370778259)
200816 00:24:03 >> log scanned up to (6370778259)
200816 00:24:04 >> log scanned up to (6370778259)
200816 00:24:05 >> log scanned up to (6370778259)
200816 00:24:06 >> log scanned up to (6370778259)
200816 00:24:07 >> log scanned up to (6370778259)
200816 00:24:08 >> log scanned up to (6370778259)
200816 00:24:09 >> log scanned up to (6370778259)
200816 00:24:10 >> log scanned up to (6370778259)
200816 00:24:11 [01] ...done
200816 00:24:11 [01] Copying ./test/t1.ibd to /data/backup/increment_data/test/t1.ibd.delta
200816 00:24:11 >> log scanned up to (6370778259)
200816 00:24:12 >> log scanned up to (6370778259)
200816 00:24:13 >> log scanned up to (6370778259)
200816 00:24:14 >> log scanned up to (6370778259)
200816 00:24:15 >> log scanned up to (6370778259)
200816 00:24:16 >> log scanned up to (6370778259)
200816 00:24:17 >> log scanned up to (6370778259)
200816 00:24:18 >> log scanned up to (6370778259)
200816 00:24:19 >> log scanned up to (6370778259)
200816 00:24:20 >> log scanned up to (6370778259)
200816 00:24:21 >> log scanned up to (6370778259)
200816 00:24:22 >> log scanned up to (6370778259)
200816 00:24:23 >> log scanned up to (6370778259)
200816 00:24:24 >> log scanned up to (6370778259)
200816 00:24:25 >> log scanned up to (6370778259)
200816 00:24:26 >> log scanned up to (6370778259)
200816 00:24:27 >> log scanned up to (6370778259)
200816 00:24:28 >> log scanned up to (6370778259)
200816 00:24:29 >> log scanned up to (6370778259)
200816 00:24:30 >> log scanned up to (6370778259)
200816 00:24:31 >> log scanned up to (6370778259)
200816 00:24:32 >> log scanned up to (6370778259)
200816 00:24:33 >> log scanned up to (6370778259)
200816 00:24:34 >> log scanned up to (6370778259)
200816 00:24:35 >> log scanned up to (6370778259)
200816 00:24:36 >> log scanned up to (6370778259)
200816 00:24:37 >> log scanned up to (6370778259)
200816 00:24:38 [01] ...done
200816 00:24:38 [01] Copying ./mysql/slave_worker_info.ibd to /data/backup/increment_data/mysql/slave_worker_info.ibd.delta
200816 00:24:38 [01] ...done
200816 00:24:38 [01] Copying ./mysql/slave_relay_log_info.ibd to /data/backup/increment_data/mysql/slave_relay_log_info.ibd.delta
200816 00:24:38 [01] ...done
200816 00:24:38 [01] Copying ./mysql/innodb_index_stats.ibd to /data/backup/increment_data/mysql/innodb_index_stats.ibd.delta
200816 00:24:38 [01] ...done
200816 00:24:38 [01] Copying ./mysql/slave_master_info.ibd to /data/backup/increment_data/mysql/slave_master_info.ibd.delta
200816 00:24:38 [01] ...done
200816 00:24:38 [01] Copying ./mysql/innodb_table_stats.ibd to /data/backup/increment_data/mysql/innodb_table_stats.ibd.delta
200816 00:24:38 [01] ...done
200816 00:24:38 >> log scanned up to (6370778259)
200816 00:24:39 Executing FLUSH NO_WRITE_TO_BINLOG TABLES...
200816 00:24:39 Executing FLUSH TABLES WITH READ LOCK...
200816 00:24:39 Starting to backup non-InnoDB tables and files
200816 00:24:39 [01] Copying ./test1/zqs.frm to /data/backup/increment_data/test1/zqs.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./test1/db.opt to /data/backup/increment_data/test1/db.opt
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./test/t1.frm to /data/backup/increment_data/test/t1.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./test/db.opt to /data/backup/increment_data/test/db.opt
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./test/t2.frm to /data/backup/increment_data/test/t2.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/servers.MYD to /data/backup/increment_data/mysql/servers.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_name.MYI to /data/backup/increment_data/mysql/time_zone_name.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_category.MYI to /data/backup/increment_data/mysql/help_category.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_leap_second.MYD to /data/backup/increment_data/mysql/time_zone_leap_second.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone.frm to /data/backup/increment_data/mysql/time_zone.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_relation.MYI to /data/backup/increment_data/mysql/help_relation.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_category.frm to /data/backup/increment_data/mysql/help_category.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/general_log.frm to /data/backup/increment_data/mysql/general_log.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/innodb_table_stats.frm to /data/backup/increment_data/mysql/innodb_table_stats.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/proxies_priv.MYI to /data/backup/increment_data/mysql/proxies_priv.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_name.MYD to /data/backup/increment_data/mysql/time_zone_name.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_keyword.MYD to /data/backup/increment_data/mysql/help_keyword.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/proc.MYD to /data/backup/increment_data/mysql/proc.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/columns_priv.MYD to /data/backup/increment_data/mysql/columns_priv.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_topic.frm to /data/backup/increment_data/mysql/help_topic.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/event.MYI to /data/backup/increment_data/mysql/event.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/event.MYD to /data/backup/increment_data/mysql/event.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/procs_priv.MYD to /data/backup/increment_data/mysql/procs_priv.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/slow_log.CSV to /data/backup/increment_data/mysql/slow_log.CSV
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_leap_second.MYI to /data/backup/increment_data/mysql/time_zone_leap_second.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/slave_relay_log_info.frm to /data/backup/increment_data/mysql/slave_relay_log_info.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_keyword.MYI to /data/backup/increment_data/mysql/help_keyword.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition_type.MYI to /data/backup/increment_data/mysql/time_zone_transition_type.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/procs_priv.frm to /data/backup/increment_data/mysql/procs_priv.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/columns_priv.MYI to /data/backup/increment_data/mysql/columns_priv.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/general_log.CSM to /data/backup/increment_data/mysql/general_log.CSM
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_relation.frm to /data/backup/increment_data/mysql/help_relation.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/plugin.MYI to /data/backup/increment_data/mysql/plugin.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/procs_priv.MYI to /data/backup/increment_data/mysql/procs_priv.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_name.frm to /data/backup/increment_data/mysql/time_zone_name.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/tables_priv.MYI to /data/backup/increment_data/mysql/tables_priv.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition.MYD to /data/backup/increment_data/mysql/time_zone_transition.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/proc.frm to /data/backup/increment_data/mysql/proc.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/servers.frm to /data/backup/increment_data/mysql/servers.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_topic.MYI to /data/backup/increment_data/mysql/help_topic.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition.MYI to /data/backup/increment_data/mysql/time_zone_transition.MYI
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/proxies_priv.frm to /data/backup/increment_data/mysql/proxies_priv.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/slave_worker_info.frm to /data/backup/increment_data/mysql/slave_worker_info.frm
200816 00:24:39 [01] ...done
200816 00:24:39 >> log scanned up to (6370778259)
200816 00:24:39 [01] Copying ./mysql/slave_master_info.frm to /data/backup/increment_data/mysql/slave_master_info.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/func.frm to /data/backup/increment_data/mysql/func.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/user.frm to /data/backup/increment_data/mysql/user.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/plugin.MYD to /data/backup/increment_data/mysql/plugin.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/tables_priv.MYD to /data/backup/increment_data/mysql/tables_priv.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_leap_second.frm to /data/backup/increment_data/mysql/time_zone_leap_second.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition.frm to /data/backup/increment_data/mysql/time_zone_transition.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/columns_priv.frm to /data/backup/increment_data/mysql/columns_priv.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/tables_priv.frm to /data/backup/increment_data/mysql/tables_priv.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/general_log.CSV to /data/backup/increment_data/mysql/general_log.CSV
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/ndb_binlog_index.frm to /data/backup/increment_data/mysql/ndb_binlog_index.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone.MYD to /data/backup/increment_data/mysql/time_zone.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition_type.MYD to /data/backup/increment_data/mysql/time_zone_transition_type.MYD
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/db.frm to /data/backup/increment_data/mysql/db.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/innodb_index_stats.frm to /data/backup/increment_data/mysql/innodb_index_stats.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/time_zone_transition_type.frm to /data/backup/increment_data/mysql/time_zone_transition_type.frm
200816 00:24:39 [01] ...done
200816 00:24:39 [01] Copying ./mysql/help_relation.MYD to /data/backup/increment_data/mysql/help_relation.MYD
200816 00:24:39 [01] ...done
200816 00:24:40 [01] Copying ./mysql/user.MYI to /data/backup/increment_data/mysql/user.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/user.MYD to /data/backup/increment_data/mysql/user.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/slow_log.CSM to /data/backup/increment_data/mysql/slow_log.CSM
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/time_zone.MYI to /data/backup/increment_data/mysql/time_zone.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/help_category.MYD to /data/backup/increment_data/mysql/help_category.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/ndb_binlog_index.MYD to /data/backup/increment_data/mysql/ndb_binlog_index.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/ndb_binlog_index.MYI to /data/backup/increment_data/mysql/ndb_binlog_index.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/help_topic.MYD to /data/backup/increment_data/mysql/help_topic.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/plugin.frm to /data/backup/increment_data/mysql/plugin.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/event.frm to /data/backup/increment_data/mysql/event.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/func.MYD to /data/backup/increment_data/mysql/func.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/help_keyword.frm to /data/backup/increment_data/mysql/help_keyword.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/proc.MYI to /data/backup/increment_data/mysql/proc.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/proxies_priv.MYD to /data/backup/increment_data/mysql/proxies_priv.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/slow_log.frm to /data/backup/increment_data/mysql/slow_log.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/servers.MYI to /data/backup/increment_data/mysql/servers.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/db.MYI to /data/backup/increment_data/mysql/db.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/func.MYI to /data/backup/increment_data/mysql/func.MYI
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./mysql/db.MYD to /data/backup/increment_data/mysql/db.MYD
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_by_user_by_event_name.frm to /data/backup/increment_data/performance_schema/events_statements_summary_by_user_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_summary_by_user_by_event_name.frm to /data/backup/increment_data/performance_schema/events_stages_summary_by_user_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/host_cache.frm to /data/backup/increment_data/performance_schema/host_cache.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/users.frm to /data/backup/increment_data/performance_schema/users.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_by_host_by_event_name.frm to /data/backup/increment_data/performance_schema/events_waits_summary_by_host_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/socket_instances.frm to /data/backup/increment_data/performance_schema/socket_instances.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_current.frm to /data/backup/increment_data/performance_schema/events_stages_current.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_global_by_event_name.frm to /data/backup/increment_data/performance_schema/events_waits_summary_global_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/table_io_waits_summary_by_table.frm to /data/backup/increment_data/performance_schema/table_io_waits_summary_by_table.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_current.frm to /data/backup/increment_data/performance_schema/events_waits_current.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_by_instance.frm to /data/backup/increment_data/performance_schema/events_waits_summary_by_instance.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_by_account_by_event_name.frm to /data/backup/increment_data/performance_schema/events_waits_summary_by_account_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_history.frm to /data/backup/increment_data/performance_schema/events_statements_history.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_history.frm to /data/backup/increment_data/performance_schema/events_waits_history.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_by_host_by_event_name.frm to /data/backup/increment_data/performance_schema/events_statements_summary_by_host_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_history.frm to /data/backup/increment_data/performance_schema/events_stages_history.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/socket_summary_by_event_name.frm to /data/backup/increment_data/performance_schema/socket_summary_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/socket_summary_by_instance.frm to /data/backup/increment_data/performance_schema/socket_summary_by_instance.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/session_account_connect_attrs.frm to /data/backup/increment_data/performance_schema/session_account_connect_attrs.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/file_instances.frm to /data/backup/increment_data/performance_schema/file_instances.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/objects_summary_global_by_type.frm to /data/backup/increment_data/performance_schema/objects_summary_global_by_type.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_history_long.frm to /data/backup/increment_data/performance_schema/events_statements_history_long.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_by_thread_by_event_name.frm to /data/backup/increment_data/performance_schema/events_waits_summary_by_thread_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_history_long.frm to /data/backup/increment_data/performance_schema/events_stages_history_long.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_current.frm to /data/backup/increment_data/performance_schema/events_statements_current.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_by_account_by_event_name.frm to /data/backup/increment_data/performance_schema/events_statements_summary_by_account_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/table_io_waits_summary_by_index_usage.frm to /data/backup/increment_data/performance_schema/table_io_waits_summary_by_index_usage.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/accounts.frm to /data/backup/increment_data/performance_schema/accounts.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/hosts.frm to /data/backup/increment_data/performance_schema/hosts.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_by_digest.frm to /data/backup/increment_data/performance_schema/events_statements_summary_by_digest.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_history_long.frm to /data/backup/increment_data/performance_schema/events_waits_history_long.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_by_thread_by_event_name.frm to /data/backup/increment_data/performance_schema/events_statements_summary_by_thread_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/table_lock_waits_summary_by_table.frm to /data/backup/increment_data/performance_schema/table_lock_waits_summary_by_table.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_statements_summary_global_by_event_name.frm to /data/backup/increment_data/performance_schema/events_statements_summary_global_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_summary_by_thread_by_event_name.frm to /data/backup/increment_data/performance_schema/events_stages_summary_by_thread_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/db.opt to /data/backup/increment_data/performance_schema/db.opt
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/setup_objects.frm to /data/backup/increment_data/performance_schema/setup_objects.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/rwlock_instances.frm to /data/backup/increment_data/performance_schema/rwlock_instances.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/setup_instruments.frm to /data/backup/increment_data/performance_schema/setup_instruments.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/setup_timers.frm to /data/backup/increment_data/performance_schema/setup_timers.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_summary_by_account_by_event_name.frm to /data/backup/increment_data/performance_schema/events_stages_summary_by_account_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/performance_timers.frm to /data/backup/increment_data/performance_schema/performance_timers.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/session_connect_attrs.frm to /data/backup/increment_data/performance_schema/session_connect_attrs.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/cond_instances.frm to /data/backup/increment_data/performance_schema/cond_instances.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_summary_global_by_event_name.frm to /data/backup/increment_data/performance_schema/events_stages_summary_global_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/mutex_instances.frm to /data/backup/increment_data/performance_schema/mutex_instances.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/setup_actors.frm to /data/backup/increment_data/performance_schema/setup_actors.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/file_summary_by_instance.frm to /data/backup/increment_data/performance_schema/file_summary_by_instance.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_waits_summary_by_user_by_event_name.frm to /data/backup/increment_data/performance_schema/events_waits_summary_by_user_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/file_summary_by_event_name.frm to /data/backup/increment_data/performance_schema/file_summary_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/events_stages_summary_by_host_by_event_name.frm to /data/backup/increment_data/performance_schema/events_stages_summary_by_host_by_event_name.frm
200816 00:24:40 [01] ...done
200816 00:24:40 >> log scanned up to (6370778259)
200816 00:24:40 [01] Copying ./performance_schema/threads.frm to /data/backup/increment_data/performance_schema/threads.frm
200816 00:24:40 [01] ...done
200816 00:24:40 [01] Copying ./performance_schema/setup_consumers.frm to /data/backup/increment_data/performance_schema/setup_consumers.frm
200816 00:24:40 [01] ...done
200816 00:24:40 Finished backing up non-InnoDB tables and files
200816 00:24:40 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
xtrabackup: The latest check point (for incremental): '6370778259'
xtrabackup: Stopping log copying thread.
.200816 00:24:40 >> log scanned up to (6370778259)
200816 00:24:41 Executing UNLOCK TABLES
200816 00:24:41 All tables unlocked
200816 00:24:41 Backup created in directory '/data/backup/increment_data/'
200816 00:24:41 [00] Writing backup-my.cnf
200816 00:24:41 [00] ...done
200816 00:24:41 [00] Writing xtrabackup_info
200816 00:24:41 [00] ...done
xtrabackup: Transaction log of lsn (6370778259) to (6370778259) was copied.
200816 00:24:41 completed OK!
[root@monitor backup]#
还原时,mysql服务器需要关闭,而且数据目录必须是空的,innobackupex –copy-back不会覆盖已存在的文件
备份完成后,数据尚且不能用于恢复操作,因为备份的数据中可能会包含尚未提交的事务或已经提交但尚未同步至数据文件中的事务。因此,此时数据文件仍处理不一致状态。“准备”的主要作用正是通过回滚未提交的事务及同步已经提交的事务至数据文件也使得数据文件处于一致性状态。
利用 --apply-log参数,此参数的作用是通过回滚未提交的事务及同步已经提交的事务至数据文件使数据文件处于一致性状态。
执行完后,xtrabackup_checkpoints文件里面的backup_type会变成full-prepared状态(之前是full-backuped的状态)
[root@monitor backup]# cd backup_dir/
[root@monitor backup_dir]# ls
backup-my.cnf ibdata1 mysql performance_schema test test1 xtrabackup_checkpoints xtrabackup_info xtrabackup_logfile
[root@monitor backup_dir]# more xtrabackup_checkpoints
backup_type = full-backuped
from_lsn = 0
to_lsn = 6370773208
last_lsn = 6370773208
compact = 0
recover_binlog_info = 0
[root@monitor backup_dir]# innobackupex --apply-log /data/backup/backup_dir/
200816 00:28:22 innobackupex: Starting the apply-log operation
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!".
innobackupex version 2.3.4 based on MySQL server 5.6.24 Linux (x86_64) (revision id: e80c779)
xtrabackup: cd to /data/backup/backup_dir/
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(6370773208)
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 1
xtrabackup: innodb_log_file_size = 2097152
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 1
xtrabackup: innodb_log_file_size = 2097152
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: Using atomics to ref count buffer pool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
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 buffer pool
InnoDB: Highest supported file format is Barracuda.
InnoDB: The log sequence numbers 1626047 and 1626047 in ibdata files do not match the log sequence number 6370773208 in the ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages
InnoDB: from the doublewrite buffer...
InnoDB: 128 rollback segment(s) are active.
InnoDB: Waiting for purge to start
InnoDB: 5.6.24 started; log sequence number 6370773208
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 6370774129
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
InnoDB: Using atomics to ref count buffer pool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
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 buffer pool
InnoDB: Setting log file ./ib_logfile101 size to 48 MB
InnoDB: Setting log file ./ib_logfile1 size to 48 MB
InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
InnoDB: New log files created, LSN=6370774129
InnoDB: Highest supported file format is Barracuda.
InnoDB: 128 rollback segment(s) are active.
InnoDB: Waiting for purge to start
InnoDB: 5.6.24 started; log sequence number 6370774540
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 6370774550
200816 00:28:26 completed OK!
[root@monitor backup_dir]#
[root@monitor backup_dir]#
[root@monitor backup_dir]# more xtrabackup_checkpoints
backup_type = full-prepared
from_lsn = 0
to_lsn = 6370773208
last_lsn = 6370773208
compact = 0
recover_binlog_info = 0
[root@monitor backup_dir]#
-- 关闭mysql,并清除数据文件
service mysqld stop
cd mysqldata
rm -rf *
-- 还原全库
innobackupex --defaults-file=/usr/local/mysql/my.cnf --copy-back /data/backup/backup_dir/
[root@monitor mysql]# innobackupex --defaults-file=/usr/local/mysql/my.cnf --copy-back /data/backup/backup_dir/
Could not open required defaults file: /usr/local/mysql/my.cnf
Fatal error in defaults handling. Program aborted
[root@monitor mysql]#
[root@monitor mysql]#
[root@monitor mysql]# innobackupex --defaults-file=/etc/my.cnf --copy-back /data/backup/backup_dir/
200816 00:32:09 innobackupex: Starting the copy-back operation
IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints "completed OK!".
innobackupex version 2.3.4 based on MySQL server 5.6.24 Linux (x86_64) (revision id: e80c779)
200816 00:32:09 [01] Copying ib_logfile0 to /var/lib/mysql/ib_logfile0
200816 00:32:09 [01] ...done
200816 00:32:10 [01] Copying ib_logfile1 to /var/lib/mysql/ib_logfile1
200816 00:32:10 [01] ...done
200816 00:32:11 [01] Copying ibdata1 to /var/lib/mysql/ibdata1
200816 00:32:12 [01] ...done
200816 00:32:12 [01] Copying ./test1/zqs.frm to /var/lib/mysql/test1/zqs.frm
200816 00:32:12 [01] ...done
200816 00:32:12 [01] Copying ./test1/zqs.ibd to /var/lib/mysql/test1/zqs.ibd
200816 00:32:12 [01] ...done
200816 00:32:12 [01] Copying ./test1/db.opt to /var/lib/mysql/test1/db.opt
200816 00:32:12 [01] ...done
200816 00:32:12 [01] Copying ./test/t1.frm to /var/lib/mysql/test/t1.frm
200816 00:32:12 [01] ...done
200816 00:32:12 [01] Copying ./test/t2.ibd to /var/lib/mysql/test/t2.ibd
200816 00:33:26 [01] ...done
200816 00:33:26 [01] Copying ./test/db.opt to /var/lib/mysql/test/db.opt
200816 00:33:26 [01] ...done
200816 00:33:26 [01] Copying ./test/t1.ibd to /var/lib/mysql/test/t1.ibd
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./test/t2.frm to /var/lib/mysql/test/t2.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/servers.MYD to /var/lib/mysql/mysql/servers.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/time_zone_name.MYI to /var/lib/mysql/mysql/time_zone_name.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_category.MYI to /var/lib/mysql/mysql/help_category.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/time_zone_leap_second.MYD to /var/lib/mysql/mysql/time_zone_leap_second.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/time_zone.frm to /var/lib/mysql/mysql/time_zone.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_relation.MYI to /var/lib/mysql/mysql/help_relation.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_category.frm to /var/lib/mysql/mysql/help_category.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/general_log.frm to /var/lib/mysql/mysql/general_log.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/innodb_table_stats.frm to /var/lib/mysql/mysql/innodb_table_stats.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/proxies_priv.MYI to /var/lib/mysql/mysql/proxies_priv.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/slave_worker_info.ibd to /var/lib/mysql/mysql/slave_worker_info.ibd
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/time_zone_name.MYD to /var/lib/mysql/mysql/time_zone_name.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_keyword.MYD to /var/lib/mysql/mysql/help_keyword.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/proc.MYD to /var/lib/mysql/mysql/proc.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/columns_priv.MYD to /var/lib/mysql/mysql/columns_priv.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/slave_relay_log_info.ibd to /var/lib/mysql/mysql/slave_relay_log_info.ibd
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_topic.frm to /var/lib/mysql/mysql/help_topic.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/event.MYI to /var/lib/mysql/mysql/event.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/event.MYD to /var/lib/mysql/mysql/event.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/procs_priv.MYD to /var/lib/mysql/mysql/procs_priv.MYD
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/slow_log.CSV to /var/lib/mysql/mysql/slow_log.CSV
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/time_zone_leap_second.MYI to /var/lib/mysql/mysql/time_zone_leap_second.MYI
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/slave_relay_log_info.frm to /var/lib/mysql/mysql/slave_relay_log_info.frm
200816 00:34:46 [01] ...done
200816 00:34:46 [01] Copying ./mysql/help_keyword.MYI to /var/lib/mysql/mysql/help_keyword.MYI
200816 00:34:46 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition_type.MYI to /var/lib/mysql/mysql/time_zone_transition_type.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/procs_priv.frm to /var/lib/mysql/mysql/procs_priv.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/columns_priv.MYI to /var/lib/mysql/mysql/columns_priv.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/general_log.CSM to /var/lib/mysql/mysql/general_log.CSM
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_relation.frm to /var/lib/mysql/mysql/help_relation.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/plugin.MYI to /var/lib/mysql/mysql/plugin.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/procs_priv.MYI to /var/lib/mysql/mysql/procs_priv.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_name.frm to /var/lib/mysql/mysql/time_zone_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/tables_priv.MYI to /var/lib/mysql/mysql/tables_priv.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition.MYD to /var/lib/mysql/mysql/time_zone_transition.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/proc.frm to /var/lib/mysql/mysql/proc.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/servers.frm to /var/lib/mysql/mysql/servers.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_topic.MYI to /var/lib/mysql/mysql/help_topic.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/innodb_index_stats.ibd to /var/lib/mysql/mysql/innodb_index_stats.ibd
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition.MYI to /var/lib/mysql/mysql/time_zone_transition.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/proxies_priv.frm to /var/lib/mysql/mysql/proxies_priv.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/slave_worker_info.frm to /var/lib/mysql/mysql/slave_worker_info.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/slave_master_info.frm to /var/lib/mysql/mysql/slave_master_info.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/func.frm to /var/lib/mysql/mysql/func.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/user.frm to /var/lib/mysql/mysql/user.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/plugin.MYD to /var/lib/mysql/mysql/plugin.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/tables_priv.MYD to /var/lib/mysql/mysql/tables_priv.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/slave_master_info.ibd to /var/lib/mysql/mysql/slave_master_info.ibd
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_leap_second.frm to /var/lib/mysql/mysql/time_zone_leap_second.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition.frm to /var/lib/mysql/mysql/time_zone_transition.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/columns_priv.frm to /var/lib/mysql/mysql/columns_priv.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/tables_priv.frm to /var/lib/mysql/mysql/tables_priv.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/general_log.CSV to /var/lib/mysql/mysql/general_log.CSV
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/ndb_binlog_index.frm to /var/lib/mysql/mysql/ndb_binlog_index.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone.MYD to /var/lib/mysql/mysql/time_zone.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition_type.MYD to /var/lib/mysql/mysql/time_zone_transition_type.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/innodb_table_stats.ibd to /var/lib/mysql/mysql/innodb_table_stats.ibd
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/db.frm to /var/lib/mysql/mysql/db.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/innodb_index_stats.frm to /var/lib/mysql/mysql/innodb_index_stats.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone_transition_type.frm to /var/lib/mysql/mysql/time_zone_transition_type.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_relation.MYD to /var/lib/mysql/mysql/help_relation.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/user.MYI to /var/lib/mysql/mysql/user.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/user.MYD to /var/lib/mysql/mysql/user.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/slow_log.CSM to /var/lib/mysql/mysql/slow_log.CSM
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/time_zone.MYI to /var/lib/mysql/mysql/time_zone.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_category.MYD to /var/lib/mysql/mysql/help_category.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/ndb_binlog_index.MYD to /var/lib/mysql/mysql/ndb_binlog_index.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/ndb_binlog_index.MYI to /var/lib/mysql/mysql/ndb_binlog_index.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_topic.MYD to /var/lib/mysql/mysql/help_topic.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/plugin.frm to /var/lib/mysql/mysql/plugin.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/event.frm to /var/lib/mysql/mysql/event.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/func.MYD to /var/lib/mysql/mysql/func.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/help_keyword.frm to /var/lib/mysql/mysql/help_keyword.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/proc.MYI to /var/lib/mysql/mysql/proc.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/proxies_priv.MYD to /var/lib/mysql/mysql/proxies_priv.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/slow_log.frm to /var/lib/mysql/mysql/slow_log.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/servers.MYI to /var/lib/mysql/mysql/servers.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/db.MYI to /var/lib/mysql/mysql/db.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/func.MYI to /var/lib/mysql/mysql/func.MYI
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./mysql/db.MYD to /var/lib/mysql/mysql/db.MYD
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_by_user_by_event_name.frm to /var/lib/mysql/performance_schema/events_statements_summary_by_user_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_summary_by_user_by_event_name.frm to /var/lib/mysql/performance_schema/events_stages_summary_by_user_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/host_cache.frm to /var/lib/mysql/performance_schema/host_cache.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/users.frm to /var/lib/mysql/performance_schema/users.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_by_host_by_event_name.frm to /var/lib/mysql/performance_schema/events_waits_summary_by_host_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/socket_instances.frm to /var/lib/mysql/performance_schema/socket_instances.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_current.frm to /var/lib/mysql/performance_schema/events_stages_current.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_global_by_event_name.frm to /var/lib/mysql/performance_schema/events_waits_summary_global_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/table_io_waits_summary_by_table.frm to /var/lib/mysql/performance_schema/table_io_waits_summary_by_table.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_current.frm to /var/lib/mysql/performance_schema/events_waits_current.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_by_instance.frm to /var/lib/mysql/performance_schema/events_waits_summary_by_instance.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_by_account_by_event_name.frm to /var/lib/mysql/performance_schema/events_waits_summary_by_account_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_history.frm to /var/lib/mysql/performance_schema/events_statements_history.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_history.frm to /var/lib/mysql/performance_schema/events_waits_history.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_by_host_by_event_name.frm to /var/lib/mysql/performance_schema/events_statements_summary_by_host_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_history.frm to /var/lib/mysql/performance_schema/events_stages_history.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/socket_summary_by_event_name.frm to /var/lib/mysql/performance_schema/socket_summary_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/socket_summary_by_instance.frm to /var/lib/mysql/performance_schema/socket_summary_by_instance.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/session_account_connect_attrs.frm to /var/lib/mysql/performance_schema/session_account_connect_attrs.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/file_instances.frm to /var/lib/mysql/performance_schema/file_instances.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/objects_summary_global_by_type.frm to /var/lib/mysql/performance_schema/objects_summary_global_by_type.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_history_long.frm to /var/lib/mysql/performance_schema/events_statements_history_long.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_by_thread_by_event_name.frm to /var/lib/mysql/performance_schema/events_waits_summary_by_thread_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_history_long.frm to /var/lib/mysql/performance_schema/events_stages_history_long.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_current.frm to /var/lib/mysql/performance_schema/events_statements_current.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_by_account_by_event_name.frm to /var/lib/mysql/performance_schema/events_statements_summary_by_account_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/table_io_waits_summary_by_index_usage.frm to /var/lib/mysql/performance_schema/table_io_waits_summary_by_index_usage.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/accounts.frm to /var/lib/mysql/performance_schema/accounts.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/hosts.frm to /var/lib/mysql/performance_schema/hosts.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_by_digest.frm to /var/lib/mysql/performance_schema/events_statements_summary_by_digest.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_history_long.frm to /var/lib/mysql/performance_schema/events_waits_history_long.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_by_thread_by_event_name.frm to /var/lib/mysql/performance_schema/events_statements_summary_by_thread_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/table_lock_waits_summary_by_table.frm to /var/lib/mysql/performance_schema/table_lock_waits_summary_by_table.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_statements_summary_global_by_event_name.frm to /var/lib/mysql/performance_schema/events_statements_summary_global_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_summary_by_thread_by_event_name.frm to /var/lib/mysql/performance_schema/events_stages_summary_by_thread_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/db.opt to /var/lib/mysql/performance_schema/db.opt
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/setup_objects.frm to /var/lib/mysql/performance_schema/setup_objects.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/rwlock_instances.frm to /var/lib/mysql/performance_schema/rwlock_instances.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/setup_instruments.frm to /var/lib/mysql/performance_schema/setup_instruments.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/setup_timers.frm to /var/lib/mysql/performance_schema/setup_timers.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_summary_by_account_by_event_name.frm to /var/lib/mysql/performance_schema/events_stages_summary_by_account_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/performance_timers.frm to /var/lib/mysql/performance_schema/performance_timers.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/session_connect_attrs.frm to /var/lib/mysql/performance_schema/session_connect_attrs.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/cond_instances.frm to /var/lib/mysql/performance_schema/cond_instances.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_stages_summary_global_by_event_name.frm to /var/lib/mysql/performance_schema/events_stages_summary_global_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/mutex_instances.frm to /var/lib/mysql/performance_schema/mutex_instances.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/setup_actors.frm to /var/lib/mysql/performance_schema/setup_actors.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/file_summary_by_instance.frm to /var/lib/mysql/performance_schema/file_summary_by_instance.frm
200816 00:34:47 [01] ...done
200816 00:34:47 [01] Copying ./performance_schema/events_waits_summary_by_user_by_event_name.frm to /var/lib/mysql/performance_schema/events_waits_summary_by_user_by_event_name.frm
200816 00:34:47 [01] ...done
200816 00:34:48 [01] Copying ./performance_schema/file_summary_by_event_name.frm to /var/lib/mysql/performance_schema/file_summary_by_event_name.frm
200816 00:34:48 [01] ...done
200816 00:34:48 [01] Copying ./performance_schema/events_stages_summary_by_host_by_event_name.frm to /var/lib/mysql/performance_schema/events_stages_summary_by_host_by_event_name.frm
200816 00:34:48 [01] ...done
200816 00:34:48 [01] Copying ./performance_schema/threads.frm to /var/lib/mysql/performance_schema/threads.frm
200816 00:34:48 [01] ...done
200816 00:34:48 [01] Copying ./performance_schema/setup_consumers.frm to /var/lib/mysql/performance_schema/setup_consumers.frm
200816 00:34:48 [01] ...done
200816 00:34:48 [01] Copying ./xtrabackup_info to /var/lib/mysql/xtrabackup_info
200816 00:34:48 [01] ...done
200816 00:34:48 completed OK!
修改文件属主及启动mysql
chown -R mysql:mysql /var/lib/mysql
service mysqld start
“准备”(prepare)增量备份与整理完全备份有着一些不同,尤其要注意的是:
(1)需要在每个备份(包括完全和各个增量备份)上,将已经提交的事务进行“重放”。“重放”之后,所有的备份数据将合并到完全备份上。
(2)基于所有的备份将未提交的事务进行“回滚”。
-- 第一步:先apply-log全量备份
innobackupex --apply-log --redo-only /data/backup/backup_dir
-- 第二步:把增量备份数据合并到全量备份数据上
innobackupex --apply-log --redo-only /data/backup/backup_dir --incremental-dir=/data/backup/increment_data
此时增量备份上的数据已经合并到全量备份上了,查看xtrabackup_checkpoints
[root@monitor mysql]# more /data/backup/backup_dir/xtrabackup_checkpoints
backup_type = log-applied
from_lsn = 0
to_lsn = 6370776203
last_lsn = 6370776203
compact = 0
recover_binlog_info = 0
[root@monitor mysql]#
[root@monitor mysql]# more /data/backup/increment_data/xtrabackup_checkpoints
backup_type = incremental
from_lsn = 6370774560
to_lsn = 6370776203
last_lsn = 6370776203
compact = 0
recover_binlog_info = 0
-- 第三步:回滚完全备份
innobackupex --apply-log /data/backup/backup_dir
-- 第四步: 关闭mysql服务,删除数据文件
-- 第五步:还原
innobackupex --defaults-file=/etc/my.cnf --copy-back /data/backup/backup_dir
--第六步: 调整权限并启动mysql
1.https://www.cnblogs.com/fuqu/p/10618235.html
2.https://www.cnblogs.com/linuxk/p/9372990.html