一、XtraBackup安装

下载地址:http://www.percona.com/downloads/XtraBackup/XtraBackup-2.2.8/source/

安装步骤:

================================
How to build XtraBackup on Linux
================================Prerequisites
-------------$ yum install cmake gcc gcc-c++ libaio libaio-devel automake autoconf bzr bison libtool ncurses5-develCompiling with CMake
--------------------
$ cmake -DBUILD_CONFIG=xtrabackup_release && make -j4
Installation
------------
$ make install

will install all XtraBackup binaries, the innobackupex script and tests to /usr/local/xtrabackup. You can override this either with “make DESTDIR=... install” or by changing the installation layout with “cmake -DINSTALL_LAYOUT=...”.

如果出现下面报错,需要 yum install crypt* ; yum install libgcrypt*

CMake Error at cmake/gcrypt.cmake:25 (MESSAGE):Cannot find gcrypt.h in /usr/include;/usr/local/include;/opt/local/include.You can use libgcrypt-config --cflags to get the necessary path and pass itto CMake with -DGCRYPT_INCLUDE_PATH=<path>
Call Stack (most recent call first):storage/innobase/xtrabackup/src/CMakeLists.txt:20 (FIND_GCRYPT)CMake Error at cmake/gcrypt.cmake:36 (MESSAGE):Cannot find libgcrypt shared libraries in/usr/lib;/usr/local/lib;/opt/local/lib.  You can use libgcrypt-config--libs to get the necessary path and pass it to CMake with-DGCRYPT_LIB_PATH=<path>
Call Stack (most recent call first):storage/innobase/xtrabackup/src/CMakeLists.txt:20 (FIND_GCRYPT)

二、xtrabackup全备测试

普通备份(全量备份)
[root@server mysql]# mkdir /data/mysql/databak
[root@server mysql]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --backup --target-dir=/data/mysql/databak/
[root@server mysql]# cp -rp data/test/students.frm databak/test/
注意:xtrabackup只备份数据文件,并不备份数据表结构(.frm),所以这里要手动备份一下,以便xtrabackup恢复的时候使用,如果是做了分表分文件保存的话,就需要挑出.frm表结构,表数据文件.ibd不需要复制

全量备份恢复
实施对备份文件进行恢复前的准备
[root@server mysql]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --prepare --target-dir=/data/mysql/databak/
从备份目录复制对应数据库表结构到默认的数据目录[如果是做了分表分文件,则需要全部复制到默认的数据目录]
cp -r /data/mysql/databak/test /data/mysql/data/
删除默认数据目录中对应的数据文件并复制备份的数据文件到默认数据目录
rm /data/mysql/data/ib*
cp /data/mysql/databak/ib* /data/mysql/data/
修改数据目录权限[注意细节:mysql库的所有者是mysql,组是root]
chown -R mysql:mysql /data/mysql/data
重启MySQL
[root@server data]# /etc/init.d/mysqld restart

三、xtrabackup增量备份测试

1. 全备
[root@server databak]# mkdir /data/mysql/databak/
[root@server mysql]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --backup --target-dir=/data/mysql/databak/
[root@server mysql]# cp -rp data/test/students.frm databak/test/
2. 增量备份
[root@server databak]# mkdir /data/mysql/databak/delta/
[root@server databak]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --backup --incremental-basedir=/data/mysql/databak/ --target-dir=/data/mysql/databak/delta/

3. 备份恢复准备[这里没有完成增量备份,增量备份数据恢复失败]

[root@server data]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --prepare --target-dir=/data/mysql/databak/
[root@server data]# xtrabackup --defaults-file=/usr/local/mysql/my.cnf --prepare --target-dir=/data/mysql/databak/ --incremental-dir/=/data/mysql/databak/delta/

4. 恢复数据库

从备份目录复制对应数据库表结构到默认的数据目录[如果是做了分表分文件,则需要全部复制到默认的数据目录]
cp -r /data/mysql/databak/test /data/mysql/data/
删除默认数据目录中对应的数据文件并复制备份的数据文件到默认数据目录
rm /data/mysql/data/ib*
cp /data/mysql/databak/ib* /data/mysql/data/
修改数据目录权限[注意细节:mysql库的所有者是mysql,组是root]
chown -R mysql:mysql /data/mysql/data

四、用innobackupex 执行全备与增量备份

innobackupex全备和增量备份
1. 全备

[root@server mysql]# innobackupex --user=root --password=redhat /data/mysql/databak/
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 3637
main::init() called at /usr/bin/innobackupex line 1557
innobackupex: Error: option 'datadir' has different values:
'/var/lib/mysql' in defaults file
'/data/mysql/data/' in SHOW VARIABLES

执行失败,需要指定配置文件路径:

[root@server xtrabackup]# innobackupex --defaults-file=/usr/local/mysql/my.cnf --user=root --password=redhat /data/mysql/databak/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.150204 19:00:03  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/usr/local/mysql/my.cnf;mysql_read_default_group=xtrabackup' as 'root'  (using password: YES).
150204 19:00:03  innobackupex: Connected to MySQL server
150204 19:00:03  innobackupex: Executing a version check against the server...
150204 19:00:03  innobackupex: Done.
150204 19:00:03  innobackupex: Starting the backup operationIMPORTANT: Please check that the backup run completes successfully.At the end of a successful backup run innobackupexprints "completed OK!".innobackupex:  Using server version 5.5.30innobackupex: Created backup directory /data/mysql/databak/2015-02-04_19-00-03150204 19:00:03  innobackupex: Starting ibbackup with command: xtrabackup  --defaults-file="/usr/local/mysql/my.cnf"  --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/data/mysql/databak/2015-02-04_19-00-03 --tmpdir=/tmp --extra-lsndir='/tmp'
innobackupex: Waiting for ibbackup (pid=19209) to suspend
innobackupex: Suspend file '/data/mysql/databak/2015-02-04_19-00-03/xtrabackup_suspended_2'xtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/data/
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = /data/mysql/data
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 = 5242880
xtrabackup: using O_DIRECT
>> log scanned up to (1602080)
xtrabackup: Generating a list of tablespaces
[01] Copying /data/mysql/data/ibdata1 to /data/mysql/databak/2015-02-04_19-00-03/ibdata1
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
>> log scanned up to (1602080)
[01]        ...done
>> log scanned up to (1602080)
[01] Copying ./test/students.ibd to /data/mysql/databak/2015-02-04_19-00-03/test/students.ibd
[01]        ...done
>> log scanned up to (1602080)
xtrabackup: Creating suspend file '/data/mysql/databak/2015-02-04_19-00-03/xtrabackup_suspended_2' with pid '19209'150204 19:00:17  innobackupex: Continuing after ibbackup has suspended
150204 19:00:17  innobackupex: Executing FLUSH TABLES WITH READ LOCK...
150204 19:00:17  innobackupex: All tables locked and flushed to disk150204 19:00:17  innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of '/data/mysql/data/'
innobackupex: Backing up files '/data/mysql/data//performance_schema/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
>> log scanned up to (1602080)
innobackupex: Backing up file '/data/mysql/data//test/students.frm'
innobackupex: Backing up files '/data/mysql/data//mysql/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (72 files)
150204 19:00:17  innobackupex: Finished backing up non-InnoDB tables and files150204 19:00:17  innobackupex: Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
150204 19:00:17  innobackupex: Waiting for log copying to finishxtrabackup: The latest check point (for incremental): '1602080'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (1602080)xtrabackup: Creating suspend file '/data/mysql/databak/2015-02-04_19-00-03/xtrabackup_log_copied' with pid '19209'
xtrabackup: Transaction log of lsn (1602080) to (1602080) was copied.
150204 19:00:18  innobackupex: All tables unlockedinnobackupex: Backup created in directory '/data/mysql/databak/2015-02-04_19-00-03'
150204 19:00:18  innobackupex: Connection to database server closed
150204 19:00:18  innobackupex: completed OK!

2. 第一次增量备份
#--incremental:增量备份的文件夹
#--incremental-dir:针对哪个做增量备份

[root@server databak]# innobackupex --defaults-file=/usr/local/mysql/my.cnf --user=root --password=redhat --incremental  /data/mysql/databak/ --incremental-dir /data/mysql/databak/2015-02-04_19-00-03/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.150204 19:03:58  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/usr/local/mysql/my.cnf;mysql_read_default_group=xtrabackup' as 'root'  (using password: YES).
150204 19:03:58  innobackupex: Connected to MySQL server
150204 19:03:58  innobackupex: Executing a version check against the server...
150204 19:03:58  innobackupex: Done.
150204 19:03:58  innobackupex: Starting the backup operationIMPORTANT: Please check that the backup run completes successfully.At the end of a successful backup run innobackupexprints "completed OK!".innobackupex:  Using server version 5.5.30innobackupex: Created backup directory /data/mysql/databak/2015-02-04_19-03-58150204 19:03:58  innobackupex: Starting ibbackup with command: xtrabackup  --defaults-file="/usr/local/mysql/my.cnf"  --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/data/mysql/databak/2015-02-04_19-03-58 --tmpdir=/tmp --extra-lsndir='/tmp' --incremental-basedir='/data/mysql/databak/2015-02-04_19-00-03'
innobackupex: Waiting for ibbackup (pid=19349) to suspend
innobackupex: Suspend file '/data/mysql/databak/2015-02-04_19-03-58/xtrabackup_suspended_2'xtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
incremental backup from 1602080 is enabled.
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/data/
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = /data/mysql/data
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 = 5242880
xtrabackup: using O_DIRECT
>> log scanned up to (1602919)
xtrabackup: Generating a list of tablespaces
xtrabackup: using the full scan for incremental backup
[01] Copying /data/mysql/data/ibdata1 to /data/mysql/databak/2015-02-04_19-03-58/ibdata1.delta
>> log scanned up to (1602919)
>> log scanned up to (1602919)
>> log scanned up to (1602919)
>> log scanned up to (1602919)
>> log scanned up to (1602919)
[01]        ...done
[01] Copying ./test/students.ibd to /data/mysql/databak/2015-02-04_19-03-58/test/students.ibd.delta
[01]        ...done
>> log scanned up to (1602919)
xtrabackup: Creating suspend file '/data/mysql/databak/2015-02-04_19-03-58/xtrabackup_suspended_2' with pid '19349'150204 19:04:05  innobackupex: Continuing after ibbackup has suspended
150204 19:04:05  innobackupex: Executing FLUSH TABLES WITH READ LOCK...
150204 19:04:05  innobackupex: All tables locked and flushed to disk150204 19:04:05  innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of '/data/mysql/data/'
innobackupex: Backing up files '/data/mysql/data//performance_schema/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (18 files)
>> log scanned up to (1602919)
innobackupex: Backing up file '/data/mysql/data//test/students.frm'
innobackupex: Backing up files '/data/mysql/data//mysql/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (72 files)
150204 19:04:06  innobackupex: Finished backing up non-InnoDB tables and files150204 19:04:06  innobackupex: Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
150204 19:04:06  innobackupex: Waiting for log copying to finishxtrabackup: The latest check point (for incremental): '1602919'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (1602919)xtrabackup: Creating suspend file '/data/mysql/databak/2015-02-04_19-03-58/xtrabackup_log_copied' with pid '19349'
xtrabackup: Transaction log of lsn (1602919) to (1602919) was copied.
150204 19:04:07  innobackupex: All tables unlockedinnobackupex: Backup created in directory '/data/mysql/databak/2015-02-04_19-03-58'
150204 19:04:07  innobackupex: Connection to database server closed
150204 19:04:07  innobackupex: completed OK!
[root@server databak]# ls
2015-02-04_19-00-03  2015-02-04_19-03-58
[root@server databak]# ll
total 8
drwxr-xr-x. 5 root root 4096 Feb  4 19:00 2015-02-04_19-00-03
drwxr-xr-x. 5 root root 4096 Feb  4 19:04 2015-02-04_19-03-58
[root@server databak]# du -sh *
1.1G    2015-02-04_19-00-03
1.5M    2015-02-04_19-03-58

3. 模拟数据丢失

mysql> drop database test;
Query OK, 1 row affected (0.14 sec)mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

4. 将全备数据执行prepare

[root@server 2015-02-04_19-03-58]# innobackupex --apply-log --redo-only /data/mysql/databak/2015-02-04_19-00-03/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.150204 19:10:15  innobackupex: Starting the apply-log operationIMPORTANT: Please check that the apply-log run completes successfully.At the end of a successful apply-log run innobackupexprints "completed OK!".150204 19:10:15  innobackupex: Starting ibbackup with command: xtrabackup  --defaults-file="/data/mysql/databak/2015-02-04_19-00-03/backup-my.cnf"  --defaults-group="mysqld" --prepare --target-dir=/data/mysql/databak/2015-02-04_19-00-03 --apply-log-onlyxtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
xtrabackup: cd to /data/mysql/databak/2015-02-04_19-00-03
xtrabackup: This target seems to be not prepared yet.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(1602080)
xtrabackup: using the following InnoDB configuration for recovery:
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: using the following InnoDB configuration for recovery:
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: Using atomics to ref count buffer pool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Memory barrier is not used
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, size = 100.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Highest supported file format is Barracuda.
InnoDB: The log sequence numbers 1602070 and 1602070 in ibdata files do not match the log sequence number 1602080 in the ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages
InnoDB: from the doublewrite buffer...[notice (again)]If you use binary log and don't use any hack of group commit,
  the binary log position seems to be:xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 1602080
150204 19:10:16  innobackupex: completed OK!

5. 将增量备份数据合并到全备中

[root@server 2015-02-04_19-03-58]# innobackupex --apply-log --redo-only --incremental /data/mysql/databak/2015-02-04_19-00-03/ --incremental-dir=/data/mysql/databak/2015-02-04_19-03-58/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.150204 19:10:19  innobackupex: Starting the apply-log operationIMPORTANT: Please check that the apply-log run completes successfully.At the end of a successful apply-log run innobackupexprints "completed OK!".150204 19:10:19  innobackupex: Starting ibbackup with command: xtrabackup  --defaults-file="/data/mysql/databak/2015-02-04_19-00-03/backup-my.cnf"  --defaults-group="mysqld" --prepare --target-dir=/data/mysql/databak/2015-02-04_19-00-03 --apply-log-only --incremental-dir=/data/mysql/databak/2015-02-04_19-03-58/xtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
incremental backup from 1602080 is enabled.
xtrabackup: cd to /data/mysql/databak/2015-02-04_19-00-03
xtrabackup: This target seems to be already prepared.
xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(1602919)
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup:   innodb_log_group_home_dir = /data/mysql/databak/2015-02-04_19-03-58/
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 2097152
xtrabackup: Generating a list of tablespaces
xtrabackup: page size for /data/mysql/databak/2015-02-04_19-03-58//ibdata1.delta is 16384 bytes
Applying /data/mysql/databak/2015-02-04_19-03-58//ibdata1.delta to ./ibdata1...
xtrabackup: page size for /data/mysql/databak/2015-02-04_19-03-58//test/students.ibd.delta is 16384 bytes
Applying /data/mysql/databak/2015-02-04_19-03-58//test/students.ibd.delta to ./test/students.ibd...
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup:   innodb_log_group_home_dir = /data/mysql/databak/2015-02-04_19-03-58/
xtrabackup:   innodb_log_files_in_group = 1
xtrabackup:   innodb_log_file_size = 2097152
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
InnoDB: Using atomics to ref count buffer pool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Memory barrier is not used
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, size = 100.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Highest supported file format is Barracuda.
InnoDB: The log sequence numbers 1602070 and 1602070 in ibdata files do not match the log sequence number 1602919 in the ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages
InnoDB: from the doublewrite buffer...[notice (again)]If you use binary log and don't use any hack of group commit,
  the binary log position seems to be:xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 1602919
innobackupex: Starting to copy non-InnoDB files in '/data/mysql/databak/2015-02-04_19-03-58/'
innobackupex: to the full backup directory '/data/mysql/databak/2015-02-04_19-00-03'
innobackupex: Copying '/data/mysql/databak/2015-02-04_19-03-58/xtrabackup_info' to '/data/mysql/databak/2015-02-04_19-00-03/xtrabackup_info'
innobackupex: Copying '/data/mysql/databak/2015-02-04_19-03-58/performance_schema/db.opt' to '/data/mysql/databak/2015-02-04_19-00-03/performance_schema/db.opt'
innobackupex: Copying '/data/mysql/databak/2015-02-04_19-03-58/performance_schema/events_waits_summary_by_thread_by_event_name.frm' to '/data/mysql/databak/2015-02-04_19-00-03/performance_schema/events_waits_summary_by_thread_by_event_name.frm'
innobackupex: Copying '/data/mysql/databak/2015-02-04_19-03-58/performance_schema/file_summary_by_instance.frm' to '/data/mysql/databak/2015-02-04_19-00-03/performance_schema/file_summary_by_instance.frm'..........150204 19:10:20  innobackupex: completed OK!

6. 停止mysqld服务,恢复数据

[root@server 2015-02-04_19-03-58]# /etc/init.d/mysqld stop
Shutting down MySQL...                                     [  OK  ]
[root@server data]# innobackupex --defaults-file=/usr/local/mysql/my.cnf --copy-back /data/mysql/databak/2015-02-04_19-00-03/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.150204 19:13:47  innobackupex: Starting the copy-back operationIMPORTANT: Please check that the copy-back run completes successfully.At the end of a successful copy-back run innobackupexprints "completed OK!".innobackupex: Starting to copy files in '/data/mysql/databak/2015-02-04_19-00-03'

.........innobackupex: Starting to copy InnoDB system tablespace
innobackupex: in '/data/mysql/databak/2015-02-04_19-00-03'
innobackupex: back to original InnoDB data directory '/data/mysql/data'
innobackupex: Copying '/data/mysql/databak/2015-02-04_19-00-03/ibdata1' to '/data/mysql/data/ibdata1'innobackupex: Starting to copy InnoDB undo tablespaces
innobackupex: in '/data/mysql/databak/2015-02-04_19-00-03'
innobackupex: back to '/data/mysql/data/'innobackupex: Starting to copy InnoDB log files
innobackupex: in '/data/mysql/databak/2015-02-04_19-00-03'
innobackupex: back to original InnoDB log directory '/data/mysql/data/'
innobackupex: Finished copying back files.150204 19:13:53  innobackupex: completed OK!

7. 对恢复的文件修改权限

[root@server data]# chown -R mysql:mysql *
[root@server data]# chown -R mysql:root mysql/

8. 启动mysql服务

[root@server data]# /etc/init.d/mysqld start
Starting MySQL...                                          [  OK  ]

done ^_^

转载于:https://www.cnblogs.com/forilen/p/4273133.html

XtraBackup全备与增量备份相关推荐

  1. Xtrabackup对mysql全备以及增量备份实施

    Xtrabackup对mysql全备以及增量备份实施 1.完全备份与恢复 本文使用的是centos5.8 64位系统,mysql 使用5.5.35. 如果要使用一个最小权限的用户进行备份,可基于以下: ...

  2. percona xtrabackupd定期做全备,增量备份shell脚本

    一:全备脚本 cat xtrabackup_full.sh #!/bin/bash local_ip="$(/sbin/ifconfig eth0|grep 'inet addr'|awk ...

  3. Linux 平台下 RMAN 全备 和 增量备份 shell 脚本

    一. 一些准备知识 Oracle 分归档和非归档模式. 这两者的区别就是对redo log的处理.归档模式下,当一个redo log 写满之后,就会把这个redo log里的内容写入归档文件,等写完之 ...

  4. mysql异地增量备份工具_利用 xtrabackup 工具实现增量备份 mysql(附脚本)

    1.安装 percona 源 yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-rel ...

  5. xtrabackup全量+增量备份

    xtrabackup:是用于热备份innodb, xtradb表中数据的工具,不能备份其他类型的表,也不能备份数据表结构: innobackupex:是将xtrabackup进行封装的perl脚本,可 ...

  6. xtrabackup增量备份实例

    安装xtrabackup 解压xtrabackup安装包并安装 [root@localhost /]# mkdir xtrabackup [root@localhost /]# cd xtraback ...

  7. mysql整备_【mysql】使用xtrabackup在线增量备份及恢复数据库

    一.Percona Xtrabackup 简介 1.Xtrabackup  bin目录文件 介绍 1)innobackupex innobackupex 是xtrabackup的一个符号链接 . in ...

  8. 通过XtraBackup进行数据库表备份和表空间传输实例

    一.安装教程 1.XtraBackup简介 XtraBackup有很多功能和优点:例如支持全备.增量备份.部分备份:支持压缩备份:备份不影响数据读写.事务等,但是也有缺陷不足:例如不支持脱机备份.不支 ...

  9. MySQL 的物理备份、逻辑备份、增量备份

    物理备份 , 冷备 cp .tar 首先需要两台PC: mysql   121.40.25.207                                     mysql02   47.9 ...

最新文章

  1. 65个免费和高质量的纹理包
  2. 总结JavaScript常用数组操作方法,包含ES6方法
  3. 最长公共子序列LCS
  4. 大屏可视化分配率是什么意思_什么是分配率?
  5. Java-什么是面向对象
  6. iPhone 14 Pro影像规格曝光:升级48MP主摄 镜头模组也大了
  7. MySQL性能半同步复制VS异步复制
  8. 算法笔记-二分查找和二分答案
  9. autocad 二次开发 拆分图纸_2,手动创建CAD二次开发项目--AutoCAD二次开发(2020版)...
  10. vuetify图标不正常显示
  11. namecheap域名如何绑定IP
  12. 电商项目需求分析---七月实习总结
  13. 层次方框图、Warnier图、IPO图
  14. 用Hive、Impala查询Hbase数据
  15. CH341A及XTW 2两种SPI FLASH烧录器的硬件使用说明_20220920【可用于升级主板BIOS】
  16. 微信小程序入门与实战之阅读列表与setData数据的绑定
  17. 特大通知!!!CSDN和简书博客以后同步更新
  18. ai个性化 国庆 头像 合成
  19. 安装nodejs时提示Leaving directory
  20. 前端项目实战95-数组遍历继续处理

热门文章

  1. php重定向页面位置,php - PHP重定向到基于页面版本的用户位置(IPAPI),并在会话中记住 - SO中文参考 - www.soinside.com...
  2. 『设计模式』设计模式--策略模式
  3. PADS 中的 PIN TYPE 说明
  4. 同域下iframe操作时,js访问document出现拒绝访问的问题原因
  5. 【图像分类】如何使用 mmclassification 训练自己的分类模型
  6. C语言高级编程:char、signed char 和 unsigned char的使用区别
  7. 银行委托第三方催收信用卡欠款,是合法吗?
  8. 女孩子应该养成的好习惯
  9. pagerank数据集_从数据结构到算法:图网络方法初探
  10. python字符串索引必须是整数_TypeError:在Python中,字符串索引必须是整数