SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
XtraBackup 使用简介
XtraBackup 使用简介
作者:叶金荣
编写日期: 2011-04-27
目录
1 测试说明........................................................................................................................... 2
2 XtraBackup 简介 ............................................................................................................. 2
3 XtraBackup 特点 ............................................................................................................. 3
3.1 下载 XtraBackup.......................................................................................................... 3
3.2 XtraBackup 使用方法.................................................................................................. 4
3.3 XtraBackup 配置选项详解.......................................................................................... 6
3.4 XtraBackup 实际案例................................................................................................ 11
3.4.1 做一次数据全备...................................................................................................... 11
3.4.2 做一次数据增备...................................................................................................... 14
XtraBackup 使用简介
3.4.3 做一次数据恢复...................................................................................................... 17
3.4.3.1 只有一次全备...................................................................................................... 17
3.4.3.2 同时应用增备...................................................................................................... 20
3.5 innobackup 实际案例................................................................................................ 24
3.5.1 准备配置文件.......................................................................................................... 24
3.5.2 做一次数据全备...................................................................................................... 25
3.5.3 做一次数据增备...................................................................................................... 31
3.5.4 做一次数据恢复...................................................................................................... 32
3.5.4.1 只有一次全备...................................................................................................... 32
3.5.4.2 同时应用增备...................................................................................................... 37
4 结语................................................................................................................................. 41
1 测试说明
本次测试了 XtraBackup 这个在线热备工具的使用方法,考察其在实际生产
环境中的应用前景、可行性及方案。
2 XtraBackup 简介
简言之,XtraBackup 是 Percona 推出的一个基于 MySQL XtraDB 引擎的在
XtraBackup 使用简介
线热备工具,是一个开源项目。XtraDB 引擎其实是 InnoDB 引擎的变种,因此
这个工具也是支持原生态 InnoDB 引擎的。它同时也能支持对 MyISAM 引擎的
备份,目前可支持 MySQL 5.0、5.1、5.5 等多个版本。不过目前还不支持 InnoDB
Plugin 新版本引擎。XtraBackup 项目基于 GPL V2 协议分发。
3 XtraBackup 特点
XtraBackup 工具的主要特点有:
 支持在线(无需加锁)备份 InnoDB/XtraDB 引擎;对于 MyISAM 引擎,则
需要加一个只读锁,当然了,也可以不加
 支持数据流压缩备份,支持磁带、异地备份
 支持增备
XtraBackup 软件主要有 2 个工具:
 xtrabackup–二进制文件,用于拷贝 InnoDB/XtraDB 表空间文件
 innobackupex– 封 装 后 的 脚 本 , 基 于 innobackupPerl 脚 本 , 由
Oracle/InnoDB 基于 GPL 协议分发。该脚本用于接收各种参数,然后调
用 xtrabackup 进行实际工作。该脚本提供了各种函数,用于备份 MySQL
下的 InnoDB、XtraDB、MyISAM 等多种引擎。
3.1 下载 XtraBackup
可以在:http://www.percona.com/downloads/XtraBackup/ 上下载到该工具。
当前最新稳定版本是 1.5,同时提供了多种格式的安装包,支持多种操作系统,
XtraBackup 使用简介
包括:Linux、Debian、FreeBSD、Solaris、Windows 等。同时还提供源码,可
自行编译,因此实际可以支持更多平台。
3.2 XtraBackup 使用方法
XtraBackup 一般的用法为:
备份:xtrabackup [DEFAULTS OPTION] –backup
恢复:xtrabackup [DEFAULTS OPTION] –prepare] [OPTIONS]
上面提到的 DEFAULTS OPTION 选项,默认从以下顺序的配置文件中读取:
/etc/my.cnf
/opt/mysql-5.0.xx/etc/my.cnf
~/.my.cnf
只读取配置文件的“mysqld”和“xtrabackup”部分。
另外,下面的选项列表作为 XtraBackup 的第一参数:
(The following 4 options may be given as the first argument)
--print-defaults Print the program argument list and exit
--no-defaults Don't read default options from any options file
--defaults-file=# Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read
--target-dir=name destination directory
--backup take backup to target-dir
XtraBackup 使用简介
--stats calc statistic of datadir (offline mysqld is recommended)
--prepare prepare a backup for starting mysql server on the backup.
--export create files to import to another database when prepare.
--print-param print parameter of mysqld needed for copyback.
--use-memory=# The value is used instead of buffer_pool_size
--suspend-at-end creates a file 'xtrabackup_suspended' and waits until the
user deletes that file at the end of '--backup'
--throttle=# limit count of IO operations (pairs of read&write) per
second to IOS values (for '--backup')
--log-stream outputs the contents of 'xtrabackup_logfile' to stdout
only until the file 'xtrabackup_suspended' deleted (for
'--backup').
--incremental-lsn=name
(for --backup): copy only .ibd pages newer than specified
LSN 'high:low'. ##ATTENTION##: checkpoint lsn must be
used. anyone can detect your mistake. be carefully!
--incremental-basedir=name
(for --backup): copy only .ibd pages newer than backup at
specified directory.
--incremental-dir=name
(for --prepare): apply .delta files and logfile in the
specified directory.
XtraBackup 使用简介
--tables=name filtering by regexp for table names.
--create-ib-logfile ** not work for now** creates ib_logfile* also after
'--prepare'. ### If you want create ib_logfile*, only
re-execute this command in same options. ###
-h, --datadir=name Path to the database root.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
separated by a colon (:), in this case they are used in a
round-robin fashion.
throttle–限制每秒的 IOS 数量,以避免瞬间对服务器性能产生较大影响。
不过,设置太小的话,可能会导致备份进度太慢(比如跟不上事务日志的更新速
度)。
target-dir–数据备份目标目录
Datadir 选项必须在命令行或 my.cnf 配置文件的[mysqld] 中体现
可以设置 my.cnf 文件中[xtrabackup]这个分区的全部选项(如果配置文件
中,[xtrabackup]放在[mysqld]后面,则这些选项会覆盖前面的值)。
3.3 XtraBackup 配置选项详解
详细的选项不再逐个解释,可自行查看。
Options for xtrabackup. The All options are read from [mysqld] and
[xtrabackup] section of my.cnf.
XtraBackup 使用简介
--datadir
[required]: This option is same for mysqld. And this shuld be same to
mysqld. So, you should set datadir at [mysqld] section of my.cnf .
--target-dir
[required]: This option specifies the target directory to put the backup files.
If not exist, ”–backup” option creates the directory.
attention: We must use fullpath expression.
--backup
stores the backup data files (*.ibd) and a backup log file (named
'xtrabackup_logfile') in the directory specified in target-dir
--prepare
prepares a backup for starting mysqld from the backup files stored
by ”–backup” option. It applies the log records in 'xtrabackup_logfile' to the data
files.
attention: In current version, you should re-execute ”–prepare”, if you want
ib_logfile* here. (This is restriction of the alpha version)
--print-param
This option is used by innobackup script. It generates target mysqld
XtraBackup 使用简介
information for “innobackup –copy-back” like this.
# This MySQL options file was generated by XtraBackup.
[mysqld]
datadir = /opt/mysql-5.0.67/data
innodb_data_home_dir = /opt/mysql-5.0.67/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /opt/mysql-5.0.67/data
--defaults-file=#
This option is same to the other MySQL tools. It can specify the my.cnf
only read.
--defaults-extra-file=#
This option is also same to the other MySQL tools. It can specify the
my.cnf additionally read.
--use-memory=#
This option is for ”–prepare”. This is not same to the same named option of
ibbackup. It is used as innodb_buffer_pool_size of the InnoDB instance
of ”–prepare”. The default value is 100M bytes. But 1G or 2G bytes are
recommended if you can.
XtraBackup 使用简介
--export
This option is for ”–prepare”. It makes to output “clean” .ibd files and .exp
files for 'ALTER TABLE … IMPORT TABLESPACE' command
innodb_expand_import option enabled XtraDB. .exp file is generated at the
same place of the each .ibd file
--suspend-at-end
This option is for ”–backup”. creates a file 'xtrabackup_suspended' and
waits until the user deletes that file at the end. It is used in backup scripts for
synchronizing the end position of the backup transaction log file to the another
backup.
--log-stream
This option is for ”–backup”. outputs the contents of 'xtrabackup_logfile' to
stdout only, –suspend-at-end is added automatically. It may be useful when
you use your own backup tool. (innobackupex –stream mode also uses this
option.)
--incremental-lsn=LSN_HIGH:LSN_LOW
This option is for ”–backup”. Copy only .ibd pages newer than specified
LSN 'high:low'.
The checkpoint LSN must be used. (The checkpoint LSN of the previous
XtraBackup 使用简介
backup is printed out when ”–backup”, and stored at 'xtrabackup_checkpoints'
file)
--incremental-basedir=name
This option is for ”–backup”. Copy only .ibd pages newer than backup at
specified directory. ('xtrabackup_checkpoints' of the directory is read and the
LSN is used automatically.)
--incremental-dir=name
This option is for ”–prepare”. Apply the incremental backup files (*.delta &
xtrabackup_logfile) in the specified directory.
--tables=REGEXP
This option only backup the file-per-table datafiles whose table name
“db_name.table_name” is matching to the regular expression REGEXP.
--throttle=#
This option is for ”–backup”. limits count of IO operations (pairs of
read&write) per second to IOS values. (At ”–incremental” mode, it is based on
rather read IO)
XtraBackup 使用简介
--create-ib-logfile
This option is for ”–prepare”. no effect for now
attention: In current version, you should re-execute ”–prepare”, if you want
ib_logfile* here.
--tmpdir
It is read from my.cnf. But it is not used by xtrabackup for now.
--innodb_*
InnoDB options for the target mysqld. Ordinarily, they are read from my.cnf
and we don't care about their settings.
3.4 XtraBackup 实际案例
3.4.1 做一次数据全备
[@test20110427]# xtrabackup --target-dir=/path/20110427/ --backup --throttle=100
xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /home/mysql
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
XtraBackup 使用简介
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 268435456
xtrabackup: use O_DIRECT
110427 11:43:04 InnoDB: Warning: allocated tablespace 27, old maximum was 9
>> log scanned up to (13670891)
[01] Copying ./ibdata1
to /home/databak/20110427//ibdata1
>> log scanned up to (13670891)
>> log scanned up to (13670891)
>> log scanned up to (13670891)
>> log scanned up to (13670891)
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_money_etc.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_money_etc.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_metric.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_service_metric.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_host_status.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_host_status.ibd
[01] ...done
XtraBackup 使用简介
[01] Copying ./cyou_monitor_ldj/tb_money_work.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_money_work.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_profession.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_exp_profession.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_money_life.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_money_life.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_status.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_service_status.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_metric_data.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_service_metric_data.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_host.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_host.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_pet.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_exp_pet.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service.ibd
XtraBackup 使用简介
to /home/databak/20110427//cyou_monitor_ldj/tb_service.ibd
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_player.ibd
to /home/databak/20110427//cyou_monitor_ldj/tb_exp_player.ibd
[01] ...done
xtrabackup: The latest check point (for incremental): '6742998'
>> log scanned up to (13670891)
xtrabackup: Stopping log copying thread.
xtrabackup: Transaction log of lsn (13670891) to (13670891) was copied.
可以看到,默认地,把所有的 InnoDB 引擎表备份到指定目录下,同时记录
了最后的事务编号,当前是:13670891。便于下一次做增备,以及后续的数据
恢复。
3.4.2 做一次数据增备
[@test 20110427]# xtrabackup --backup --throttle=100 
--target-dir=/home/databak/20110427/2011042712/ 
--incremental-basedir=/home/databak/20110427 
xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64)
incremental backup from 13670891is enabled.
xtrabackup: uses posix_fadvise().
XtraBackup 使用简介
xtrabackup: cd to /home/mysql
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 268435456
xtrabackup: use O_DIRECT
110427 11:52:13 InnoDB: Warning: allocated tablespace 27, old maximum was 9
>> log scanned up to (13670891)
[01] Copying ./ibdata1
to /home/databak/20110427/2011042712//ibdata1.delta
>> log scanned up to (13670891)
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_money_etc.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_etc.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_metric.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_metric.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_host_status.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_host_status.ibd.delta
XtraBackup 使用简介
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_money_work.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_work.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_profession.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_profession.ibd.delta
>> log scanned up to (13719595)
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_money_life.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_life.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_status.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_status.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service_metric_data.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_metric_data.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_host.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_host.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_pet.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_pet.ibd.delta
XtraBackup 使用简介
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_service.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service.ibd.delta
[01] ...done
[01] Copying ./cyou_monitor_ldj/tb_exp_player.ibd
to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_player.ibd.delta
[01] ...done
xtrabackup: The latest check point (for incremental): '13724040'
>> log scanned up to (13724040)
xtrabackup: Stopping log copying thread..
xtrabackup: Transaction log of lsn (13670891) to (13724040) was copied.
可以看到,增备数据的事务编号更新到了:13724040。
3.4.3 做一次数据恢复
3.4.3.1 只有一次全备
[@test 20110427]# xtrabackup --prepare --target-dir=/home/databak/20110427
xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64)
xtrabackup: cd to /home/databak/20110427
xtrabackup: This target seems to be already prepared.
xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'.
XtraBackup 使用简介
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 268435456
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
innodb_write_io_threads instead
mysqladmin pr110428 15:45:26 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
110428 15:45:28 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
XtraBackup 使用简介
110428 15:45:29 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110428 15:45:29 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009
110428 15:45:30 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence
number 13670891
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110428 15:45:30 InnoDB: Starting shutdown...
110428 15:45:31 InnoDB: Shutdown completed; log sequence number 13670891
可以看到,如果只应用全备数据的话,那么事务序号只恢复到了:13670891,
而不是最新的:13724040。
XtraBackup 使用简介
3.4.3.2 同时应用增备
恢复增备数据时,要先对全备数据做一次应用,再做一次增备数据应用。
#先应用全备数据
[@test 20110427]# cd /home/databak/20110427
[@test 20110427]# xtrabackup --prepare --target-dir=./
xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64)
xtrabackup: cd to ./
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(6742998)
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G: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: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
XtraBackup 使用简介
innodb_write_io_threads instead
110427 13:50:05 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110427 13:50:05 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Last MySQL binlog file position 0 6591484, file name /home/binlog/binlog.000009
110427 13:50:05 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence
number 13670891
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 6591484, file name /home/binlog/binlog.000009
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110427 13:50:05 InnoDB: Starting shutdown...
110427 13:50:06 InnoDB: Shutdown completed; log sequence number 13670891
#再次应用增备数据
[@test 20110427]# xtrabackup --prepare --target-dir=./ --incremental-dir=./2011042712/
XtraBackup 使用简介
xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64)
incremental backup from 13670891is enabled. #增备开始恢复的点
xtrabackup: cd to ./
xtrabackup: This target seems to be already prepared.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(13670891)
#应用增备数据
Applying ./2011042712//ibdata1.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_exp_pet.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_exp_player.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_exp_profession.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_host.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_money_work.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_service_metric.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_money_life.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_money_etc.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_service.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_service_metric_data.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_host_status.ibd.delta ...
Applying ./2011042712//cyou_monitor_ldj/tb_service_status.ibd.delta ...
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
XtraBackup 使用简介
xtrabackup: innodb_log_group_home_dir = ./2011042712/
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: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
innodb_write_io_threads instead
110427 13:50:12 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110427 13:50:12 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009
110427 13:50:12 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence
number 13724040 #应用到最新的日志点
[notice (again)]
If you use binary log and don't use any hack of group commit,
XtraBackup 使用简介
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110427 13:50:12 InnoDB: Starting shutdown...
110427 13:50:13 InnoDB: Shutdown completed; log sequence number 13724040
可以看到,这时候事务日志点更新到了:13724040,已经是最新的了。
3.5 innobackup 实际案例
3.5.1 准备配置文件
Xtrabackup 可以预先读取配置文件,根据配置文件定义的规则执行备份,下
面是一个配置文件的案例:
#
#xtrabackup / innobackupex
#
[client]
socket = /home/mysql_DBPORT/mysql.sock
[xtrabackup]
#设定数据源
datadir = /home/mysql_DBPORT
XtraBackup 使用简介
user = mysql
socket = /home/mysql_DBPORT/mysql.sock
innodb_data_file_path = ibdata1:1G:autoextend
transaction_isolation = READ-COMMITTED
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
#设定要备份的数据表,正则表达,其余的忽略,不做备份
tables="cy_.*|c_char_cyou|c_gm_list"
3.5.2 做一次数据全备
innobackupex 
#指定读取的配置文件路径
--defaults-file=/home/databak/3001/xtrabackup.cnf 
#创建的目录不带时间戳
--no-timestamp 
#并发 1 个线程运行
--parallel=1
#设备备份时,每秒 IO 上限是 100,防止系统 IO 负载过高
--throttle=100 
#同时备份 slave 信息
--slave-info 
#备份时,会先执行 stop slave,确保能获取最准确的 slave 信息
XtraBackup 使用简介
--safe-slave-backup 
#不锁表,针对 myisam 表引擎
--no-lock 
#指定备份文件存储目标路径
/home/databak/3001/20110715
#开始发起备份
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona Inc 2009-2011. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
#开始准备,连接到 mysql 中,查看 binlog,slave 等信息
110715 19:34:10 innobackupex: Starting mysql with options:
--defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered --
110715 19:34:10 innobackupex: Connected to database with mysql child process (pid=27240)
110715 19:34:16 innobackupex: Connection to database server closed
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
innobackupex: Using Logging to file '/home/mysql/query.log'
XtraBackup 使用简介
innobackupex: Using mysql server version Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems,
Inc.
#确定要备份的数据表清单
xtrabackup: tables regcomp(ip_blacklist|ip_limitdef|ip_whitelist|ip_logs|ip_entity_task|ip_entity_login_7):
Success
innobackupex: Created backup directory /home/databak/test/20110715
110715 19:34:16 innobackupex: Starting mysql with options:
--defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered --
110715 19:34:16 innobackupex: Connected to database with mysql child process (pid=27263)
110715 19:34:20 innobackupex: Connection to database server closed
110715 19:34:20 innobackupex: Starting ibbackup with command: xtrabackup
--defaults-file="/home/databak/bm_3307/xtrabackup.cnf" --backup --suspend-at-end
--target-dir=/home/databak/test/20110715 --throttle=100
innobackupex: Waiting for ibbackup (pid=27279) to suspend
innobackupex: Suspend file '/home/databak/test/20110715/xtrabackup_suspended'
#开始备份共享表空间,备份各 InnoDB 表,第一次记录 redo log 信息
xtrabackup: tables regcomp(ip_blacklist|ip_limitdef|ip_whitelist|ip_logs|ip_entity_task|ip_entity_login_7):
Success
xtrabackup Ver 1.6 Rev 245 for 5.1.55 unknown-linux-gnu (x86_64)
XtraBackup 使用简介
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /home/mysql_3307
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 268435456
110715 19:34:20 InnoDB: Warning: allocated tablespace 10, old maximum was 9
>> log scanned up to (13919335100)
[01] Copying ./ibdata1
to /home/databak/test/20110715/ibdata1
>> log scanned up to (13919335366)
>> log scanned up to (13919335366)
[01] ...done
[01] Copying ./billing_mother/ip_blacklist.ibd
to /home/databak/test/20110715/billing_mother/ip_blacklist.ibd
[01] ...done
[01] ...done
[01] Copying ./bm_tlbb/ip_whitelist.ibd
to /home/databak/test/20110715/bm_tlbb/ip_whitelist.ibd
[01] ...done
XtraBackup 使用简介
#开始备份其他非 InnoDB 表
110715 19:34:58 innobackupex: Continuing after ibbackup has suspended
110715 19:34:58 innobackupex: Starting mysql with options:
--defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered --
110715 19:34:58 innobackupex: Connected to database with mysql child process (pid=27303)
>> log scanned up to (13919335641)
>> log scanned up to (13919335641)
innobackupex:: Slave open temp tables: 0
110715 19:35:08 innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI,
innobackupex: .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in
innobackupex: subdirectories of '/home/mysql_3307'
innobackupex: Backing up files
'/home/mysql_3307/mysql/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (69 files)
innobackupex: Backing up files
'/home/mysql_3307/billing_mother/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18
files)
innobackupex: Backing up files
'/home/mysql_3307/bm_dj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
innobackupex: Backing up files
'/home/mysql_3307/bm_dj1_xyj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
XtraBackup 使用简介
innobackupex: Backing up files
'/home/mysql_3307/bm_dj1_zwj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18
files)
innobackupex: Backing up files
'/home/mysql_3307/bm_tlbb/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
110715 19:35:09 innobackupex: Finished backing
up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files
innobackupex: Resuming ibbackup
#第二次记录 redo log 信息,记录 binlog 信息
xtrabackup: The latest check point (for incremental): '13919335641'
>> log scanned up to (13919335641)
xtrabackup: Stopping log copying thread.
xtrabackup: Transaction log of lsn (13919335100) to (13919335641) was copied.
innobackupex:: Starting slave SQL thread
110715 19:35:11 innobackupex: Connection to database server closed
innobackupex: Backup created in directory '/home/databak/test/20110715'
110715 19:35:11 innobackupex: completed OK!
至此,innobackupex 做数据库全备完毕。
XtraBackup 使用简介
查看备份前后 redo log 的 checkpoint 信息:
backup_type = full-backuped
from_lsn = 0
to_lsn = 13919335641
last_lsn = 13919335641
可以看到,备份期间 checkpoint 一直未发生变化。
3.5.3 做一次数据增备
执行增备和全备类似,只需要增加指定全备数据的路径即可。例如:
innobackupex 
--defaults-file=/home/databak/bm_3307/xtrabackup.cnf 
--no-timestamp 
--parallel=1 
--throttle=100 
--slave-info 
--safe-slave-backup 
--no-lock 
#设定本次备份类型是增备,同时增备文件保存的路径
--incremental /home/databak/test/20110715/2011071518 
#设定全备文件的路径
--incremental-basedir=/home/databak/test/20110715
XtraBackup 使用简介
3.5.4 做一次数据恢复
3.5.4.1 只有一次全备
做数据恢复时,和用 xtrabackup 备份的文件恢复相似,还更简单。
#1. 恢复全备
#直接进入备份文件所在目录,执行 –apply-log 操作即可
[@tc_19_66 20110714]# cd /home/databak/20110714
[@tc_19_66 20110714]# innobackupex --apply-log .
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona Inc 2009-2011. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!".
110714 17:46:48 innobackupex: Starting ibbackup with command: xtrabackup --prepare
XtraBackup 使用简介
--target-dir=/opt/home/databak/20110714
xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64)
xtrabackup: cd to /opt/home/databak/20110714
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(13916925521)
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G: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: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
innodb_write_io_threads instead
110714 17:46:49 InnoDB: Initializing buffer pool, size = 100.0M
110714 17:46:49 InnoDB: Completed initialization of buffer pool
110714 17:46:49 InnoDB: highest supported file format is Barracuda.
XtraBackup 使用简介
InnoDB: Log scan progressed past the checkpoint lsn 13916925521
110714 17:46:49 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Doing recovery: scanned up to log sequence number 13916926358 (0 %)
110714 17:46:49 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: In a MySQL replication slave the last master binlog file
InnoDB: position 0 480763006, file name bm153_binlog.000032
InnoDB: and relay log file
InnoDB: position 0 480763154, file name /home/binlog/bm_relay_3307.000046
InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110714 17:46:50 InnoDB: Starting shutdown...
XtraBackup 使用简介
110714 17:46:50 InnoDB: Shutdown completed; log sequence number 13917110931
110714 17:46:50 innobackupex: Restarting xtrabackup with command: xtrabackup --prepare
--target-dir=/opt/home/databak/20110714
for creating ib_logfile*
xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64)
xtrabackup: cd to /opt/home/databak/20110714
xtrabackup: This target seems to be already prepared.
xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'.
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 268435456
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
XtraBackup 使用简介
innodb_write_io_threads instead
110714 17:46:50 InnoDB: Initializing buffer pool, size = 100.0M
110714 17:46:50 InnoDB: Completed initialization of buffer pool
110714 17:46:50 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
110714 17:46:52 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 256 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200
110714 17:46:54 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110714 17:46:54 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: In a MySQL replication slave the last master binlog file
InnoDB: position 0 480763006, file name bm153_binlog.000032
InnoDB: and relay log file
InnoDB: position 0 480763154, file name /home/binlog/bm_relay_3307.000046
InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015
XtraBackup 使用简介
110714 17:46:55 Percona XtraDB (http://www.percona.com) 1.0.15-12.5 started; log sequence number
13917111308
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110714 17:46:55 InnoDB: Starting shutdown...
110714 17:46:55 InnoDB: Shutdown completed; log sequence number 13917111308
110714 17:46:55 innobackupex: completed OK!
3.5.4.2 同时应用增备
#2. 恢复增备
#进入全备文件所在目录,也是执行—apply-log,同时指定增备文件对应的路径即可
[@tc_19_66 20110714]# cd /home/databak/20110714
[@tc_19_66 20110714]# innobackupex --apply-log /home/databak/20110714
--incremental-dir=/home/databak/20110714/2011071415/
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona Inc 2009-2011. All Rights Reserved.
XtraBackup 使用简介
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!".
110714 19:50:30 innobackupex: Starting ibbackup with command: xtrabackup --prepare
--target-dir=/home/databak/20110714 --incremental-dir=/home/databak/20110714/2011071415/
xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64)
incremental backup from 13916926358 is enabled.
xtrabackup: cd to /home/databak/20110714
xtrabackup: This target seems to be already prepared.
xtrabackup: xtrabackup_logfile detected: size=2359296, start_lsn=(13917151324)
xtrabackup: page size for /home/databak/20110714/2011071415//ibdata1.delta is 16384 bytes
Applying /home/databak/20110714/2011071415//ibdata1.delta ...
...
xtrabackup: page size for /home/databak/20110714/2011071415//billing_mother/ip_entity_task.ibd.delta
XtraBackup 使用简介
is 16384 bytes
Applying /home/databak/20110714/2011071415//billing_mother/ip_entity_task.ibd.delta ...
xtrabackup: Temporary instance for recovery is set as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = /home/databak/20110714/2011071415/
xtrabackup: innodb_log_files_in_group = 1
xtrabackup: innodb_log_file_size = 2359296
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
innodb_write_io_threads instead
110714 19:50:31 InnoDB: Initializing buffer pool, size = 100.0M
110714 19:50:31 InnoDB: Completed initialization of buffer pool
110714 19:50:31 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 13917151324
110714 19:50:31 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
XtraBackup 使用简介
InnoDB: Doing recovery: scanned up to log sequence number 13917151604 (0 %)
110714 19:50:31 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: In a MySQL replication slave the last master binlog file
InnoDB: position 0 481059264, file name bm153_binlog.000032
InnoDB: and relay log file
InnoDB: position 0 481059412, file name /home/binlog/bm_relay_3307.000046
InnoDB: Last MySQL binlog file position 0 279409214, file name /home/binlog/bm_binlog_3307.000015
110714 19:50:31 Percona XtraDB (http://www.percona.com) 1.0.15-12.5 started; log sequence number
13917151604
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 279409214, file name /home/binlog/bm_binlog_3307.000015
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
110714 19:50:31 InnoDB: Starting shutdown...
110714 19:50:32 InnoDB: Shutdown completed; log sequence number 13917151604
110714 19:50:32 innobackupex: completed OK!
XtraBackup 使用简介
最后,将恢复出来的文件拷贝到 MySQL 指定的 datadir 下,即可启动 mysqld
服务了。
4 结语
从目前来看,由于 XtraBackup 第一次做数据全备时,会读取全部在线数据
库表空间文件,会对性能影响较大,因此不适合在只有单机且业务量、数据量都
较大的情景中使用,较适合在部署双机热备环境的从库下使用。可以定期做一次
全备,再周期性做一次增备,同时还有 binlog 等辅助备份,基本上足以保证数
据的安全性了。

Más contenido relacionado

La actualidad más candente

Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Eduardo Castro
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
MySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryMySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryKeith Hollman
 
Mysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsMysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsRogério Rocha
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsCommand Prompt., Inc
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and RecoveryAnar Godjaev
 
GitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedGitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedAlexey Lesovsky
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryContinuent
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage enginesVasudeva Rao
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysqlVasudeva Rao
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres MonitoringDenish Patel
 
My sql monitoring cu沙龙
My sql monitoring cu沙龙My sql monitoring cu沙龙
My sql monitoring cu沙龙colderboy17
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2PoguttuezhiniVP
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterI Goo Lee
 

La actualidad más candente (20)

Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
 
How To Sediment
How To SedimentHow To Sediment
How To Sediment
 
MySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online RecoveryMySQL Enterprise Backup: PITR Partial Online Recovery
MySQL Enterprise Backup: PITR Partial Online Recovery
 
Mysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsMysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windows
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and Recovery
 
GitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedGitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons Learned
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & Recovery
 
My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysql
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
My sql monitoring cu沙龙
My sql monitoring cu沙龙My sql monitoring cu沙龙
My sql monitoring cu沙龙
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
PostgreSQL Replication Tutorial
PostgreSQL Replication TutorialPostgreSQL Replication Tutorial
PostgreSQL Replication Tutorial
 
Db health check
Db health checkDb health check
Db health check
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
 

Destacado

Why Video Over Ip
Why Video Over IpWhy Video Over Ip
Why Video Over Ipdjgood
 
ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718Jinrong Ye
 
Historia De Engormix2
Historia De Engormix2Historia De Engormix2
Historia De Engormix2Engormix.com
 
Historia De Engormix
Historia De EngormixHistoria De Engormix
Historia De EngormixEngormix.com
 
Historia De Engormix
Historia De EngormixHistoria De Engormix
Historia De EngormixEngormix.com
 
InnoDB引擎数据表压缩特性测试 - 20120329
InnoDB引擎数据表压缩特性测试 - 20120329InnoDB引擎数据表压缩特性测试 - 20120329
InnoDB引擎数据表压缩特性测试 - 20120329Jinrong Ye
 
At One Resources
At One ResourcesAt One Resources
At One Resourcesserhio2009
 
Michigan Administrative Rules for Special Education
Michigan Administrative Rules for Special EducationMichigan Administrative Rules for Special Education
Michigan Administrative Rules for Special EducationEarly On Michigan
 
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...As You Sow
 
At One Credential
At One CredentialAt One Credential
At One Credentialserhio2009
 
Hai Vision Video Furnace Overview
Hai Vision Video Furnace OverviewHai Vision Video Furnace Overview
Hai Vision Video Furnace Overviewdjgood
 
Hp dl380 g7测试结果报告 - 20100823
Hp dl380 g7测试结果报告 - 20100823Hp dl380 g7测试结果报告 - 20100823
Hp dl380 g7测试结果报告 - 20100823Jinrong Ye
 
Kadin (29 Juli 2009)
Kadin (29 Juli 2009)Kadin (29 Juli 2009)
Kadin (29 Juli 2009)Bio Perforasi
 

Destacado (20)

Progetto Comunicazione
Progetto ComunicazioneProgetto Comunicazione
Progetto Comunicazione
 
Why Video Over Ip
Why Video Over IpWhy Video Over Ip
Why Video Over Ip
 
ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718ibbackup vs mysqldump对比测试 - 20080718
ibbackup vs mysqldump对比测试 - 20080718
 
Historia De Engormix2
Historia De Engormix2Historia De Engormix2
Historia De Engormix2
 
Google And Search Engines
Google And Search EnginesGoogle And Search Engines
Google And Search Engines
 
Historia De Engormix
Historia De EngormixHistoria De Engormix
Historia De Engormix
 
Historia De Engormix
Historia De EngormixHistoria De Engormix
Historia De Engormix
 
Lumen fidei
Lumen fideiLumen fidei
Lumen fidei
 
InnoDB引擎数据表压缩特性测试 - 20120329
InnoDB引擎数据表压缩特性测试 - 20120329InnoDB引擎数据表压缩特性测试 - 20120329
InnoDB引擎数据表压缩特性测试 - 20120329
 
Acollida: serveis de la Biblioteca ETSAV
Acollida: serveis de la Biblioteca ETSAVAcollida: serveis de la Biblioteca ETSAV
Acollida: serveis de la Biblioteca ETSAV
 
Bunchculturedeck
BunchculturedeckBunchculturedeck
Bunchculturedeck
 
At One Resources
At One ResourcesAt One Resources
At One Resources
 
Michigan Administrative Rules for Special Education
Michigan Administrative Rules for Special EducationMichigan Administrative Rules for Special Education
Michigan Administrative Rules for Special Education
 
Child Find Webinar May2008
Child Find Webinar May2008Child Find Webinar May2008
Child Find Webinar May2008
 
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...
Disclosing the Facts 2014: Transparency and Risk in Hydraulic Fracturing Oper...
 
At One Credential
At One CredentialAt One Credential
At One Credential
 
Hai Vision Video Furnace Overview
Hai Vision Video Furnace OverviewHai Vision Video Furnace Overview
Hai Vision Video Furnace Overview
 
Hp dl380 g7测试结果报告 - 20100823
Hp dl380 g7测试结果报告 - 20100823Hp dl380 g7测试结果报告 - 20100823
Hp dl380 g7测试结果报告 - 20100823
 
Kadin (29 Juli 2009)
Kadin (29 Juli 2009)Kadin (29 Juli 2009)
Kadin (29 Juli 2009)
 
How Early On Works
How Early On Works How Early On Works
How Early On Works
 

Similar a Xtrabackup工具使用简介 - 20110427

OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovNETWAYS
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMark Leith
 
Rman workshop short
Rman workshop shortRman workshop short
Rman workshop shortNabi Abdul
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101Trinath Somanchi
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiNilnandan Joshi
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linuxVasudeva Rao
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backupAndrejs Vorobjovs
 
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0sprdd
 
Linux con europe_2014_f
Linux con europe_2014_fLinux con europe_2014_f
Linux con europe_2014_fsprdd
 
Meb Backup & Recovery Performance
Meb Backup & Recovery PerformanceMeb Backup & Recovery Performance
Meb Backup & Recovery PerformanceKeith Hollman
 
Performance all teh things
Performance all teh thingsPerformance all teh things
Performance all teh thingsMarcus Deglos
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaYoungHeon (Roy) Kim
 
Deploy hadoop cluster
Deploy hadoop clusterDeploy hadoop cluster
Deploy hadoop clusterChirag Ahuja
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuWirabumi Software
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingMarian Marinov
 
Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Anastasia Lubennikova
 
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...NETWAYS
 

Similar a Xtrabackup工具使用简介 - 20110427 (20)

OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey KopytovOSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
OSDC 2012 | Taking hot backups with XtraBackup by Alexey Kopytov
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Rman workshop short
Rman workshop shortRman workshop short
Rman workshop short
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101
 
Mydumper
MydumperMydumper
Mydumper
 
Percona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ MumbaiPercona xtrabackup - MySQL Meetup @ Mumbai
Percona xtrabackup - MySQL Meetup @ Mumbai
 
Multiple instances on linux
Multiple instances on linuxMultiple instances on linux
Multiple instances on linux
 
My two cents about Mysql backup
My two cents about Mysql backupMy two cents about Mysql backup
My two cents about Mysql backup
 
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
 
Linux con europe_2014_f
Linux con europe_2014_fLinux con europe_2014_f
Linux con europe_2014_f
 
Meb Backup & Recovery Performance
Meb Backup & Recovery PerformanceMeb Backup & Recovery Performance
Meb Backup & Recovery Performance
 
Performance all teh things
Performance all teh thingsPerformance all teh things
Performance all teh things
 
Ae backup
Ae backupAe backup
Ae backup
 
MySQL Backup & Recovery
MySQL Backup & RecoveryMySQL Backup & Recovery
MySQL Backup & Recovery
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & Grafana
 
Deploy hadoop cluster
Deploy hadoop clusterDeploy hadoop cluster
Deploy hadoop cluster
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)Advanced backup methods (Postgres@CERN)
Advanced backup methods (Postgres@CERN)
 
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...
OSBConf 2015 | Backups with rdiff backup and rsnapshot by christoph mitasch &...
 

Más de Jinrong Ye

为什么学习MySQL-20220530.pdf
为什么学习MySQL-20220530.pdf为什么学习MySQL-20220530.pdf
为什么学习MySQL-20220530.pdfJinrong Ye
 
如何针对业务做DB优化
如何针对业务做DB优化如何针对业务做DB优化
如何针对业务做DB优化Jinrong Ye
 
程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍Jinrong Ye
 
MySQL运维那些事
MySQL运维那些事MySQL运维那些事
MySQL运维那些事Jinrong Ye
 
高效Linux SA
高效Linux SA高效Linux SA
高效Linux SAJinrong Ye
 
MySQL设计、优化、运维
MySQL设计、优化、运维MySQL设计、优化、运维
MySQL设计、优化、运维Jinrong Ye
 
我们的MySQL
我们的MySQL我们的MySQL
我们的MySQLJinrong Ye
 
MySQL数据库设计、优化
MySQL数据库设计、优化MySQL数据库设计、优化
MySQL数据库设计、优化Jinrong Ye
 
MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化Jinrong Ye
 
MySQL压力测试经验
MySQL压力测试经验MySQL压力测试经验
MySQL压力测试经验Jinrong Ye
 
Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用Jinrong Ye
 
Tpcc mysql使用手册 - 20120329
Tpcc mysql使用手册 - 20120329Tpcc mysql使用手册 - 20120329
Tpcc mysql使用手册 - 20120329Jinrong Ye
 
MySQL 6.0 下的cluster + replicate - 20080220
MySQL 6.0 下的cluster + replicate - 20080220MySQL 6.0 下的cluster + replicate - 20080220
MySQL 6.0 下的cluster + replicate - 20080220Jinrong Ye
 
Handler socket测试报告 - 20110422
Handler socket测试报告 - 20110422Handler socket测试报告 - 20110422
Handler socket测试报告 - 20110422Jinrong Ye
 
mysql cluster测试记录 - 20120905
mysql cluster测试记录 - 20120905mysql cluster测试记录 - 20120905
mysql cluster测试记录 - 20120905Jinrong Ye
 
dell服务器raid冷迁移方法
dell服务器raid冷迁移方法dell服务器raid冷迁移方法
dell服务器raid冷迁移方法Jinrong Ye
 
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223Jinrong Ye
 
服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130Jinrong Ye
 

Más de Jinrong Ye (18)

为什么学习MySQL-20220530.pdf
为什么学习MySQL-20220530.pdf为什么学习MySQL-20220530.pdf
为什么学习MySQL-20220530.pdf
 
如何针对业务做DB优化
如何针对业务做DB优化如何针对业务做DB优化
如何针对业务做DB优化
 
程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍程序猿都该知道的MySQL秘籍
程序猿都该知道的MySQL秘籍
 
MySQL运维那些事
MySQL运维那些事MySQL运维那些事
MySQL运维那些事
 
高效Linux SA
高效Linux SA高效Linux SA
高效Linux SA
 
MySQL设计、优化、运维
MySQL设计、优化、运维MySQL设计、优化、运维
MySQL设计、优化、运维
 
我们的MySQL
我们的MySQL我们的MySQL
我们的MySQL
 
MySQL数据库设计、优化
MySQL数据库设计、优化MySQL数据库设计、优化
MySQL数据库设计、优化
 
MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化
 
MySQL压力测试经验
MySQL压力测试经验MySQL压力测试经验
MySQL压力测试经验
 
Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用
 
Tpcc mysql使用手册 - 20120329
Tpcc mysql使用手册 - 20120329Tpcc mysql使用手册 - 20120329
Tpcc mysql使用手册 - 20120329
 
MySQL 6.0 下的cluster + replicate - 20080220
MySQL 6.0 下的cluster + replicate - 20080220MySQL 6.0 下的cluster + replicate - 20080220
MySQL 6.0 下的cluster + replicate - 20080220
 
Handler socket测试报告 - 20110422
Handler socket测试报告 - 20110422Handler socket测试报告 - 20110422
Handler socket测试报告 - 20110422
 
mysql cluster测试记录 - 20120905
mysql cluster测试记录 - 20120905mysql cluster测试记录 - 20120905
mysql cluster测试记录 - 20120905
 
dell服务器raid冷迁移方法
dell服务器raid冷迁移方法dell服务器raid冷迁移方法
dell服务器raid冷迁移方法
 
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223
PC服务器阵列卡管理简易手册 叶金荣@CYOU-20121223
 
服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130
 

Último

Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 

Último (20)

Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 

Xtrabackup工具使用简介 - 20110427

  • 1. XtraBackup 使用简介 XtraBackup 使用简介 作者:叶金荣 编写日期: 2011-04-27 目录 1 测试说明........................................................................................................................... 2 2 XtraBackup 简介 ............................................................................................................. 2 3 XtraBackup 特点 ............................................................................................................. 3 3.1 下载 XtraBackup.......................................................................................................... 3 3.2 XtraBackup 使用方法.................................................................................................. 4 3.3 XtraBackup 配置选项详解.......................................................................................... 6 3.4 XtraBackup 实际案例................................................................................................ 11 3.4.1 做一次数据全备...................................................................................................... 11 3.4.2 做一次数据增备...................................................................................................... 14
  • 2. XtraBackup 使用简介 3.4.3 做一次数据恢复...................................................................................................... 17 3.4.3.1 只有一次全备...................................................................................................... 17 3.4.3.2 同时应用增备...................................................................................................... 20 3.5 innobackup 实际案例................................................................................................ 24 3.5.1 准备配置文件.......................................................................................................... 24 3.5.2 做一次数据全备...................................................................................................... 25 3.5.3 做一次数据增备...................................................................................................... 31 3.5.4 做一次数据恢复...................................................................................................... 32 3.5.4.1 只有一次全备...................................................................................................... 32 3.5.4.2 同时应用增备...................................................................................................... 37 4 结语................................................................................................................................. 41 1 测试说明 本次测试了 XtraBackup 这个在线热备工具的使用方法,考察其在实际生产 环境中的应用前景、可行性及方案。 2 XtraBackup 简介 简言之,XtraBackup 是 Percona 推出的一个基于 MySQL XtraDB 引擎的在
  • 3. XtraBackup 使用简介 线热备工具,是一个开源项目。XtraDB 引擎其实是 InnoDB 引擎的变种,因此 这个工具也是支持原生态 InnoDB 引擎的。它同时也能支持对 MyISAM 引擎的 备份,目前可支持 MySQL 5.0、5.1、5.5 等多个版本。不过目前还不支持 InnoDB Plugin 新版本引擎。XtraBackup 项目基于 GPL V2 协议分发。 3 XtraBackup 特点 XtraBackup 工具的主要特点有:  支持在线(无需加锁)备份 InnoDB/XtraDB 引擎;对于 MyISAM 引擎,则 需要加一个只读锁,当然了,也可以不加  支持数据流压缩备份,支持磁带、异地备份  支持增备 XtraBackup 软件主要有 2 个工具:  xtrabackup–二进制文件,用于拷贝 InnoDB/XtraDB 表空间文件  innobackupex– 封 装 后 的 脚 本 , 基 于 innobackupPerl 脚 本 , 由 Oracle/InnoDB 基于 GPL 协议分发。该脚本用于接收各种参数,然后调 用 xtrabackup 进行实际工作。该脚本提供了各种函数,用于备份 MySQL 下的 InnoDB、XtraDB、MyISAM 等多种引擎。 3.1 下载 XtraBackup 可以在:http://www.percona.com/downloads/XtraBackup/ 上下载到该工具。 当前最新稳定版本是 1.5,同时提供了多种格式的安装包,支持多种操作系统,
  • 4. XtraBackup 使用简介 包括:Linux、Debian、FreeBSD、Solaris、Windows 等。同时还提供源码,可 自行编译,因此实际可以支持更多平台。 3.2 XtraBackup 使用方法 XtraBackup 一般的用法为: 备份:xtrabackup [DEFAULTS OPTION] –backup 恢复:xtrabackup [DEFAULTS OPTION] –prepare] [OPTIONS] 上面提到的 DEFAULTS OPTION 选项,默认从以下顺序的配置文件中读取: /etc/my.cnf /opt/mysql-5.0.xx/etc/my.cnf ~/.my.cnf 只读取配置文件的“mysqld”和“xtrabackup”部分。 另外,下面的选项列表作为 XtraBackup 的第一参数: (The following 4 options may be given as the first argument) --print-defaults Print the program argument list and exit --no-defaults Don't read default options from any options file --defaults-file=# Only read default options from the given file # --defaults-extra-file=# Read this file after the global files are read --target-dir=name destination directory --backup take backup to target-dir
  • 5. XtraBackup 使用简介 --stats calc statistic of datadir (offline mysqld is recommended) --prepare prepare a backup for starting mysql server on the backup. --export create files to import to another database when prepare. --print-param print parameter of mysqld needed for copyback. --use-memory=# The value is used instead of buffer_pool_size --suspend-at-end creates a file 'xtrabackup_suspended' and waits until the user deletes that file at the end of '--backup' --throttle=# limit count of IO operations (pairs of read&write) per second to IOS values (for '--backup') --log-stream outputs the contents of 'xtrabackup_logfile' to stdout only until the file 'xtrabackup_suspended' deleted (for '--backup'). --incremental-lsn=name (for --backup): copy only .ibd pages newer than specified LSN 'high:low'. ##ATTENTION##: checkpoint lsn must be used. anyone can detect your mistake. be carefully! --incremental-basedir=name (for --backup): copy only .ibd pages newer than backup at specified directory. --incremental-dir=name (for --prepare): apply .delta files and logfile in the specified directory.
  • 6. XtraBackup 使用简介 --tables=name filtering by regexp for table names. --create-ib-logfile ** not work for now** creates ib_logfile* also after '--prepare'. ### If you want create ib_logfile*, only re-execute this command in same options. ### -h, --datadir=name Path to the database root. -t, --tmpdir=name Path for temporary files. Several paths may be specified, separated by a colon (:), in this case they are used in a round-robin fashion. throttle–限制每秒的 IOS 数量,以避免瞬间对服务器性能产生较大影响。 不过,设置太小的话,可能会导致备份进度太慢(比如跟不上事务日志的更新速 度)。 target-dir–数据备份目标目录 Datadir 选项必须在命令行或 my.cnf 配置文件的[mysqld] 中体现 可以设置 my.cnf 文件中[xtrabackup]这个分区的全部选项(如果配置文件 中,[xtrabackup]放在[mysqld]后面,则这些选项会覆盖前面的值)。 3.3 XtraBackup 配置选项详解 详细的选项不再逐个解释,可自行查看。 Options for xtrabackup. The All options are read from [mysqld] and [xtrabackup] section of my.cnf.
  • 7. XtraBackup 使用简介 --datadir [required]: This option is same for mysqld. And this shuld be same to mysqld. So, you should set datadir at [mysqld] section of my.cnf . --target-dir [required]: This option specifies the target directory to put the backup files. If not exist, ”–backup” option creates the directory. attention: We must use fullpath expression. --backup stores the backup data files (*.ibd) and a backup log file (named 'xtrabackup_logfile') in the directory specified in target-dir --prepare prepares a backup for starting mysqld from the backup files stored by ”–backup” option. It applies the log records in 'xtrabackup_logfile' to the data files. attention: In current version, you should re-execute ”–prepare”, if you want ib_logfile* here. (This is restriction of the alpha version) --print-param This option is used by innobackup script. It generates target mysqld
  • 8. XtraBackup 使用简介 information for “innobackup –copy-back” like this. # This MySQL options file was generated by XtraBackup. [mysqld] datadir = /opt/mysql-5.0.67/data innodb_data_home_dir = /opt/mysql-5.0.67/data innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /opt/mysql-5.0.67/data --defaults-file=# This option is same to the other MySQL tools. It can specify the my.cnf only read. --defaults-extra-file=# This option is also same to the other MySQL tools. It can specify the my.cnf additionally read. --use-memory=# This option is for ”–prepare”. This is not same to the same named option of ibbackup. It is used as innodb_buffer_pool_size of the InnoDB instance of ”–prepare”. The default value is 100M bytes. But 1G or 2G bytes are recommended if you can.
  • 9. XtraBackup 使用简介 --export This option is for ”–prepare”. It makes to output “clean” .ibd files and .exp files for 'ALTER TABLE … IMPORT TABLESPACE' command innodb_expand_import option enabled XtraDB. .exp file is generated at the same place of the each .ibd file --suspend-at-end This option is for ”–backup”. creates a file 'xtrabackup_suspended' and waits until the user deletes that file at the end. It is used in backup scripts for synchronizing the end position of the backup transaction log file to the another backup. --log-stream This option is for ”–backup”. outputs the contents of 'xtrabackup_logfile' to stdout only, –suspend-at-end is added automatically. It may be useful when you use your own backup tool. (innobackupex –stream mode also uses this option.) --incremental-lsn=LSN_HIGH:LSN_LOW This option is for ”–backup”. Copy only .ibd pages newer than specified LSN 'high:low'. The checkpoint LSN must be used. (The checkpoint LSN of the previous
  • 10. XtraBackup 使用简介 backup is printed out when ”–backup”, and stored at 'xtrabackup_checkpoints' file) --incremental-basedir=name This option is for ”–backup”. Copy only .ibd pages newer than backup at specified directory. ('xtrabackup_checkpoints' of the directory is read and the LSN is used automatically.) --incremental-dir=name This option is for ”–prepare”. Apply the incremental backup files (*.delta & xtrabackup_logfile) in the specified directory. --tables=REGEXP This option only backup the file-per-table datafiles whose table name “db_name.table_name” is matching to the regular expression REGEXP. --throttle=# This option is for ”–backup”. limits count of IO operations (pairs of read&write) per second to IOS values. (At ”–incremental” mode, it is based on rather read IO)
  • 11. XtraBackup 使用简介 --create-ib-logfile This option is for ”–prepare”. no effect for now attention: In current version, you should re-execute ”–prepare”, if you want ib_logfile* here. --tmpdir It is read from my.cnf. But it is not used by xtrabackup for now. --innodb_* InnoDB options for the target mysqld. Ordinarily, they are read from my.cnf and we don't care about their settings. 3.4 XtraBackup 实际案例 3.4.1 做一次数据全备 [@test20110427]# xtrabackup --target-dir=/path/20110427/ --backup --throttle=100 xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64) xtrabackup: uses posix_fadvise(). xtrabackup: cd to /home/mysql xtrabackup: Target instance is assumed as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
  • 12. XtraBackup 使用简介 xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 2 xtrabackup: innodb_log_file_size = 268435456 xtrabackup: use O_DIRECT 110427 11:43:04 InnoDB: Warning: allocated tablespace 27, old maximum was 9 >> log scanned up to (13670891) [01] Copying ./ibdata1 to /home/databak/20110427//ibdata1 >> log scanned up to (13670891) >> log scanned up to (13670891) >> log scanned up to (13670891) >> log scanned up to (13670891) [01] ...done [01] Copying ./cyou_monitor_ldj/tb_money_etc.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_money_etc.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_metric.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_service_metric.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_host_status.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_host_status.ibd [01] ...done
  • 13. XtraBackup 使用简介 [01] Copying ./cyou_monitor_ldj/tb_money_work.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_money_work.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_profession.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_exp_profession.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_money_life.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_money_life.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_status.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_service_status.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_metric_data.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_service_metric_data.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_host.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_host.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_pet.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_exp_pet.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service.ibd
  • 14. XtraBackup 使用简介 to /home/databak/20110427//cyou_monitor_ldj/tb_service.ibd [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_player.ibd to /home/databak/20110427//cyou_monitor_ldj/tb_exp_player.ibd [01] ...done xtrabackup: The latest check point (for incremental): '6742998' >> log scanned up to (13670891) xtrabackup: Stopping log copying thread. xtrabackup: Transaction log of lsn (13670891) to (13670891) was copied. 可以看到,默认地,把所有的 InnoDB 引擎表备份到指定目录下,同时记录 了最后的事务编号,当前是:13670891。便于下一次做增备,以及后续的数据 恢复。 3.4.2 做一次数据增备 [@test 20110427]# xtrabackup --backup --throttle=100 --target-dir=/home/databak/20110427/2011042712/ --incremental-basedir=/home/databak/20110427 xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64) incremental backup from 13670891is enabled. xtrabackup: uses posix_fadvise().
  • 15. XtraBackup 使用简介 xtrabackup: cd to /home/mysql xtrabackup: Target instance is assumed as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 2 xtrabackup: innodb_log_file_size = 268435456 xtrabackup: use O_DIRECT 110427 11:52:13 InnoDB: Warning: allocated tablespace 27, old maximum was 9 >> log scanned up to (13670891) [01] Copying ./ibdata1 to /home/databak/20110427/2011042712//ibdata1.delta >> log scanned up to (13670891) [01] ...done [01] Copying ./cyou_monitor_ldj/tb_money_etc.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_etc.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_metric.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_metric.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_host_status.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_host_status.ibd.delta
  • 16. XtraBackup 使用简介 [01] ...done [01] Copying ./cyou_monitor_ldj/tb_money_work.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_work.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_profession.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_profession.ibd.delta >> log scanned up to (13719595) [01] ...done [01] Copying ./cyou_monitor_ldj/tb_money_life.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_money_life.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_status.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_status.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service_metric_data.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service_metric_data.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_host.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_host.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_pet.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_pet.ibd.delta
  • 17. XtraBackup 使用简介 [01] ...done [01] Copying ./cyou_monitor_ldj/tb_service.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_service.ibd.delta [01] ...done [01] Copying ./cyou_monitor_ldj/tb_exp_player.ibd to /home/databak/20110427/2011042712//cyou_monitor_ldj/tb_exp_player.ibd.delta [01] ...done xtrabackup: The latest check point (for incremental): '13724040' >> log scanned up to (13724040) xtrabackup: Stopping log copying thread.. xtrabackup: Transaction log of lsn (13670891) to (13724040) was copied. 可以看到,增备数据的事务编号更新到了:13724040。 3.4.3 做一次数据恢复 3.4.3.1 只有一次全备 [@test 20110427]# xtrabackup --prepare --target-dir=/home/databak/20110427 xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64) xtrabackup: cd to /home/databak/20110427 xtrabackup: This target seems to be already prepared. xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'.
  • 18. XtraBackup 使用简介 xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 2 xtrabackup: innodb_log_file_size = 268435456 xtrabackup: Starting InnoDB instance for recovery. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter) InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead mysqladmin pr110428 15:45:26 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 256 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 110428 15:45:28 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 256 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200
  • 19. XtraBackup 使用简介 110428 15:45:29 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 110428 15:45:29 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009 110428 15:45:30 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence number 13670891 [notice (again)] If you use binary log and don't use any hack of group commit, the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110428 15:45:30 InnoDB: Starting shutdown... 110428 15:45:31 InnoDB: Shutdown completed; log sequence number 13670891 可以看到,如果只应用全备数据的话,那么事务序号只恢复到了:13670891, 而不是最新的:13724040。
  • 20. XtraBackup 使用简介 3.4.3.2 同时应用增备 恢复增备数据时,要先对全备数据做一次应用,再做一次增备数据应用。 #先应用全备数据 [@test 20110427]# cd /home/databak/20110427 [@test 20110427]# xtrabackup --prepare --target-dir=./ xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64) xtrabackup: cd to ./ xtrabackup: This target seems to be not prepared yet. xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(6742998) xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G: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: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
  • 21. XtraBackup 使用简介 innodb_write_io_threads instead 110427 13:50:05 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 110427 13:50:05 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Last MySQL binlog file position 0 6591484, file name /home/binlog/binlog.000009 110427 13:50:05 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence number 13670891 [notice (again)] If you use binary log and don't use any hack of group commit, the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 6591484, file name /home/binlog/binlog.000009 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110427 13:50:05 InnoDB: Starting shutdown... 110427 13:50:06 InnoDB: Shutdown completed; log sequence number 13670891 #再次应用增备数据 [@test 20110427]# xtrabackup --prepare --target-dir=./ --incremental-dir=./2011042712/
  • 22. XtraBackup 使用简介 xtrabackup Ver 1.5 Rev undefined for 5.1.53 unknown-linux-gnu (x86_64) incremental backup from 13670891is enabled. #增备开始恢复的点 xtrabackup: cd to ./ xtrabackup: This target seems to be already prepared. xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(13670891) #应用增备数据 Applying ./2011042712//ibdata1.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_exp_pet.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_exp_player.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_exp_profession.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_host.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_money_work.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_service_metric.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_money_life.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_money_etc.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_service.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_service_metric_data.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_host_status.ibd.delta ... Applying ./2011042712//cyou_monitor_ldj/tb_service_status.ibd.delta ... xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
  • 23. XtraBackup 使用简介 xtrabackup: innodb_log_group_home_dir = ./2011042712/ 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: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead 110427 13:50:12 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 110427 13:50:12 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009 110427 13:50:12 Percona XtraDB (http://www.percona.com) 1.0.13-12.4 started; log sequence number 13724040 #应用到最新的日志点 [notice (again)] If you use binary log and don't use any hack of group commit,
  • 24. XtraBackup 使用简介 the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 6639763, file name /home/binlog/binlog.000009 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110427 13:50:12 InnoDB: Starting shutdown... 110427 13:50:13 InnoDB: Shutdown completed; log sequence number 13724040 可以看到,这时候事务日志点更新到了:13724040,已经是最新的了。 3.5 innobackup 实际案例 3.5.1 准备配置文件 Xtrabackup 可以预先读取配置文件,根据配置文件定义的规则执行备份,下 面是一个配置文件的案例: # #xtrabackup / innobackupex # [client] socket = /home/mysql_DBPORT/mysql.sock [xtrabackup] #设定数据源 datadir = /home/mysql_DBPORT
  • 25. XtraBackup 使用简介 user = mysql socket = /home/mysql_DBPORT/mysql.sock innodb_data_file_path = ibdata1:1G:autoextend transaction_isolation = READ-COMMITTED innodb_log_file_size = 256M innodb_log_files_in_group = 2 #设定要备份的数据表,正则表达,其余的忽略,不做备份 tables="cy_.*|c_char_cyou|c_gm_list" 3.5.2 做一次数据全备 innobackupex #指定读取的配置文件路径 --defaults-file=/home/databak/3001/xtrabackup.cnf #创建的目录不带时间戳 --no-timestamp #并发 1 个线程运行 --parallel=1 #设备备份时,每秒 IO 上限是 100,防止系统 IO 负载过高 --throttle=100 #同时备份 slave 信息 --slave-info #备份时,会先执行 stop slave,确保能获取最准确的 slave 信息
  • 26. XtraBackup 使用简介 --safe-slave-backup #不锁表,针对 myisam 表引擎 --no-lock #指定备份文件存储目标路径 /home/databak/3001/20110715 #开始发起备份 InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Percona Inc 2009-2011. All Rights Reserved. This software is published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. #开始准备,连接到 mysql 中,查看 binlog,slave 等信息 110715 19:34:10 innobackupex: Starting mysql with options: --defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered -- 110715 19:34:10 innobackupex: Connected to database with mysql child process (pid=27240) 110715 19:34:16 innobackupex: Connection to database server closed IMPORTANT: Please check that the backup run completes successfully. At the end of a successful backup run innobackupex prints "completed OK!". innobackupex: Using Logging to file '/home/mysql/query.log'
  • 27. XtraBackup 使用简介 innobackupex: Using mysql server version Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. #确定要备份的数据表清单 xtrabackup: tables regcomp(ip_blacklist|ip_limitdef|ip_whitelist|ip_logs|ip_entity_task|ip_entity_login_7): Success innobackupex: Created backup directory /home/databak/test/20110715 110715 19:34:16 innobackupex: Starting mysql with options: --defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered -- 110715 19:34:16 innobackupex: Connected to database with mysql child process (pid=27263) 110715 19:34:20 innobackupex: Connection to database server closed 110715 19:34:20 innobackupex: Starting ibbackup with command: xtrabackup --defaults-file="/home/databak/bm_3307/xtrabackup.cnf" --backup --suspend-at-end --target-dir=/home/databak/test/20110715 --throttle=100 innobackupex: Waiting for ibbackup (pid=27279) to suspend innobackupex: Suspend file '/home/databak/test/20110715/xtrabackup_suspended' #开始备份共享表空间,备份各 InnoDB 表,第一次记录 redo log 信息 xtrabackup: tables regcomp(ip_blacklist|ip_limitdef|ip_whitelist|ip_logs|ip_entity_task|ip_entity_login_7): Success xtrabackup Ver 1.6 Rev 245 for 5.1.55 unknown-linux-gnu (x86_64)
  • 28. XtraBackup 使用简介 xtrabackup: uses posix_fadvise(). xtrabackup: cd to /home/mysql_3307 xtrabackup: Target instance is assumed as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 2 xtrabackup: innodb_log_file_size = 268435456 110715 19:34:20 InnoDB: Warning: allocated tablespace 10, old maximum was 9 >> log scanned up to (13919335100) [01] Copying ./ibdata1 to /home/databak/test/20110715/ibdata1 >> log scanned up to (13919335366) >> log scanned up to (13919335366) [01] ...done [01] Copying ./billing_mother/ip_blacklist.ibd to /home/databak/test/20110715/billing_mother/ip_blacklist.ibd [01] ...done [01] ...done [01] Copying ./bm_tlbb/ip_whitelist.ibd to /home/databak/test/20110715/bm_tlbb/ip_whitelist.ibd [01] ...done
  • 29. XtraBackup 使用简介 #开始备份其他非 InnoDB 表 110715 19:34:58 innobackupex: Continuing after ibbackup has suspended 110715 19:34:58 innobackupex: Starting mysql with options: --defaults-file='/home/databak/bm_3307/xtrabackup.cnf' --unbuffered -- 110715 19:34:58 innobackupex: Connected to database with mysql child process (pid=27303) >> log scanned up to (13919335641) >> log scanned up to (13919335641) innobackupex:: Slave open temp tables: 0 110715 19:35:08 innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI, innobackupex: .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in innobackupex: subdirectories of '/home/mysql_3307' innobackupex: Backing up files '/home/mysql_3307/mysql/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (69 files) innobackupex: Backing up files '/home/mysql_3307/billing_mother/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files) innobackupex: Backing up files '/home/mysql_3307/bm_dj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files) innobackupex: Backing up files '/home/mysql_3307/bm_dj1_xyj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
  • 30. XtraBackup 使用简介 innobackupex: Backing up files '/home/mysql_3307/bm_dj1_zwj/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files) innobackupex: Backing up files '/home/mysql_3307/bm_tlbb/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files) 110715 19:35:09 innobackupex: Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files innobackupex: Resuming ibbackup #第二次记录 redo log 信息,记录 binlog 信息 xtrabackup: The latest check point (for incremental): '13919335641' >> log scanned up to (13919335641) xtrabackup: Stopping log copying thread. xtrabackup: Transaction log of lsn (13919335100) to (13919335641) was copied. innobackupex:: Starting slave SQL thread 110715 19:35:11 innobackupex: Connection to database server closed innobackupex: Backup created in directory '/home/databak/test/20110715' 110715 19:35:11 innobackupex: completed OK! 至此,innobackupex 做数据库全备完毕。
  • 31. XtraBackup 使用简介 查看备份前后 redo log 的 checkpoint 信息: backup_type = full-backuped from_lsn = 0 to_lsn = 13919335641 last_lsn = 13919335641 可以看到,备份期间 checkpoint 一直未发生变化。 3.5.3 做一次数据增备 执行增备和全备类似,只需要增加指定全备数据的路径即可。例如: innobackupex --defaults-file=/home/databak/bm_3307/xtrabackup.cnf --no-timestamp --parallel=1 --throttle=100 --slave-info --safe-slave-backup --no-lock #设定本次备份类型是增备,同时增备文件保存的路径 --incremental /home/databak/test/20110715/2011071518 #设定全备文件的路径 --incremental-basedir=/home/databak/test/20110715
  • 32. XtraBackup 使用简介 3.5.4 做一次数据恢复 3.5.4.1 只有一次全备 做数据恢复时,和用 xtrabackup 备份的文件恢复相似,还更简单。 #1. 恢复全备 #直接进入备份文件所在目录,执行 –apply-log 操作即可 [@tc_19_66 20110714]# cd /home/databak/20110714 [@tc_19_66 20110714]# innobackupex --apply-log . InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Percona Inc 2009-2011. All Rights Reserved. This software is published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. IMPORTANT: Please check that the apply-log run completes successfully. At the end of a successful apply-log run innobackupex prints "completed OK!". 110714 17:46:48 innobackupex: Starting ibbackup with command: xtrabackup --prepare
  • 33. XtraBackup 使用简介 --target-dir=/opt/home/databak/20110714 xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64) xtrabackup: cd to /opt/home/databak/20110714 xtrabackup: This target seems to be not prepared yet. xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(13916925521) xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G: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: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead 110714 17:46:49 InnoDB: Initializing buffer pool, size = 100.0M 110714 17:46:49 InnoDB: Completed initialization of buffer pool 110714 17:46:49 InnoDB: highest supported file format is Barracuda.
  • 34. XtraBackup 使用简介 InnoDB: Log scan progressed past the checkpoint lsn 13916925521 110714 17:46:49 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Doing recovery: scanned up to log sequence number 13916926358 (0 %) 110714 17:46:49 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed InnoDB: In a MySQL replication slave the last master binlog file InnoDB: position 0 480763006, file name bm153_binlog.000032 InnoDB: and relay log file InnoDB: position 0 480763154, file name /home/binlog/bm_relay_3307.000046 InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015 [notice (again)] If you use binary log and don't use any hack of group commit, the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110714 17:46:50 InnoDB: Starting shutdown...
  • 35. XtraBackup 使用简介 110714 17:46:50 InnoDB: Shutdown completed; log sequence number 13917110931 110714 17:46:50 innobackupex: Restarting xtrabackup with command: xtrabackup --prepare --target-dir=/opt/home/databak/20110714 for creating ib_logfile* xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64) xtrabackup: cd to /opt/home/databak/20110714 xtrabackup: This target seems to be already prepared. xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'. xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend xtrabackup: innodb_log_group_home_dir = ./ xtrabackup: innodb_log_files_in_group = 2 xtrabackup: innodb_log_file_size = 268435456 xtrabackup: Starting InnoDB instance for recovery. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter) InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and
  • 36. XtraBackup 使用简介 innodb_write_io_threads instead 110714 17:46:50 InnoDB: Initializing buffer pool, size = 100.0M 110714 17:46:50 InnoDB: Completed initialization of buffer pool 110714 17:46:50 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 256 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 110714 17:46:52 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 256 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 110714 17:46:54 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 110714 17:46:54 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: In a MySQL replication slave the last master binlog file InnoDB: position 0 480763006, file name bm153_binlog.000032 InnoDB: and relay log file InnoDB: position 0 480763154, file name /home/binlog/bm_relay_3307.000046 InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015
  • 37. XtraBackup 使用简介 110714 17:46:55 Percona XtraDB (http://www.percona.com) 1.0.15-12.5 started; log sequence number 13917111308 [notice (again)] If you use binary log and don't use any hack of group commit, the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 279128696, file name /home/binlog/bm_binlog_3307.000015 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110714 17:46:55 InnoDB: Starting shutdown... 110714 17:46:55 InnoDB: Shutdown completed; log sequence number 13917111308 110714 17:46:55 innobackupex: completed OK! 3.5.4.2 同时应用增备 #2. 恢复增备 #进入全备文件所在目录,也是执行—apply-log,同时指定增备文件对应的路径即可 [@tc_19_66 20110714]# cd /home/databak/20110714 [@tc_19_66 20110714]# innobackupex --apply-log /home/databak/20110714 --incremental-dir=/home/databak/20110714/2011071415/ InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy and Percona Inc 2009-2011. All Rights Reserved.
  • 38. XtraBackup 使用简介 This software is published under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991. IMPORTANT: Please check that the apply-log run completes successfully. At the end of a successful apply-log run innobackupex prints "completed OK!". 110714 19:50:30 innobackupex: Starting ibbackup with command: xtrabackup --prepare --target-dir=/home/databak/20110714 --incremental-dir=/home/databak/20110714/2011071415/ xtrabackup Ver 1.6 Rev undefined for 5.1.55 unknown-linux-gnu (x86_64) incremental backup from 13916926358 is enabled. xtrabackup: cd to /home/databak/20110714 xtrabackup: This target seems to be already prepared. xtrabackup: xtrabackup_logfile detected: size=2359296, start_lsn=(13917151324) xtrabackup: page size for /home/databak/20110714/2011071415//ibdata1.delta is 16384 bytes Applying /home/databak/20110714/2011071415//ibdata1.delta ... ... xtrabackup: page size for /home/databak/20110714/2011071415//billing_mother/ip_entity_task.ibd.delta
  • 39. XtraBackup 使用简介 is 16384 bytes Applying /home/databak/20110714/2011071415//billing_mother/ip_entity_task.ibd.delta ... xtrabackup: Temporary instance for recovery is set as followings. xtrabackup: innodb_data_home_dir = ./ xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend xtrabackup: innodb_log_group_home_dir = /home/databak/20110714/2011071415/ xtrabackup: innodb_log_files_in_group = 1 xtrabackup: innodb_log_file_size = 2359296 xtrabackup: Starting InnoDB instance for recovery. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter) InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead 110714 19:50:31 InnoDB: Initializing buffer pool, size = 100.0M 110714 19:50:31 InnoDB: Completed initialization of buffer pool 110714 19:50:31 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 13917151324 110714 19:50:31 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files...
  • 40. XtraBackup 使用简介 InnoDB: Doing recovery: scanned up to log sequence number 13917151604 (0 %) 110714 19:50:31 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed InnoDB: In a MySQL replication slave the last master binlog file InnoDB: position 0 481059264, file name bm153_binlog.000032 InnoDB: and relay log file InnoDB: position 0 481059412, file name /home/binlog/bm_relay_3307.000046 InnoDB: Last MySQL binlog file position 0 279409214, file name /home/binlog/bm_binlog_3307.000015 110714 19:50:31 Percona XtraDB (http://www.percona.com) 1.0.15-12.5 started; log sequence number 13917151604 [notice (again)] If you use binary log and don't use any hack of group commit, the binary log position seems to be: InnoDB: Last MySQL binlog file position 0 279409214, file name /home/binlog/bm_binlog_3307.000015 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 110714 19:50:31 InnoDB: Starting shutdown... 110714 19:50:32 InnoDB: Shutdown completed; log sequence number 13917151604 110714 19:50:32 innobackupex: completed OK!
  • 41. XtraBackup 使用简介 最后,将恢复出来的文件拷贝到 MySQL 指定的 datadir 下,即可启动 mysqld 服务了。 4 结语 从目前来看,由于 XtraBackup 第一次做数据全备时,会读取全部在线数据 库表空间文件,会对性能影响较大,因此不适合在只有单机且业务量、数据量都 较大的情景中使用,较适合在部署双机热备环境的从库下使用。可以定期做一次 全备,再周期性做一次增备,同时还有 binlog 等辅助备份,基本上足以保证数 据的安全性了。