MYSQL-xtrabackup-1.6.7-356-备份

1、安装xtrabackup-1.6.7-356.rhel6.i686.rpm包:

[root@localhost tmp]# rpm -ivh xtrabackup-1.6.7-356.rhel6.i686.rpm

2、备份测试:

[root@localhost percona-xtrabackup-2.1.6-Linux-i686]# innobackupex --defaults-file=/etc/my.cnf --user=root --password=w123123 --socket=/var/lib/mysql/mysql.sock /tmp

InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona Inc 2009-2012.   All Rights Reserved.

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

131127 03:30:32   innobackupex: Starting mysql with options:   --defaults-file='/etc/my.cnf' --password=xxxxxxxx --user='root' --socket='/var/lib/mysql/mysql.sock' --unbuffered --
131127 03:30:32   innobackupex: Connected to database with mysql child process (pid=4644)
131127 03:30:38   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 mysql   Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (i386) using readline 5.1
innobackupex: Using mysql server version Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

innobackupex: Created backup directory /tmp/2013-11-27_03-30-38
131127 03:30:38   innobackupex: Starting mysql with options:   --defaults-file='/etc/my.cnf' --password=xxxxxxxx --user='root' --socket='/var/lib/mysql/mysql.sock' --unbuffered --
131127 03:30:38   innobackupex: Connected to database with mysql child process (pid=4670)
131127 03:30:40   innobackupex: Connection to database server closed

131127 03:30:40   innobackupex: Starting ibbackup with command: xtrabackup_51   --defaults-file="/etc/my.cnf" --backup --suspend-at-end --target-dir=/tmp/2013-11-27_03-30-38
innobackupex: Waiting for ibbackup (pid=4677) to suspend
innobackupex: Suspend file '/tmp/2013-11-27_03-30-38/xtrabackup_suspended'

xtrabackup_51 version 1.6.7 for MySQL server 5.1.59 pc-linux-gnu (i686) (revision id: 356)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/mysql
xtrabackup: Target instance is assumed as followings.
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 2
xtrabackup:   innodb_log_file_size = 5242880
>> log scanned up to (0 44233)
[01] Copying ./ibdata1 
      to /tmp/2013-11-27_03-30-38/ibdata1
[01]         ...done

131127 03:30:42   innobackupex: Continuing after ibbackup has suspended
131127 03:30:42   innobackupex: Starting mysql with options:   --defaults-file='/etc/my.cnf' --password=xxxxxxxx --user='root' --socket='/var/lib/mysql/mysql.sock' --unbuffered --
131127 03:30:42   innobackupex: Connected to database with mysql child process (pid=4685)
131127 03:30:44   innobackupex: Starting to lock all tables...
>> log scanned up to (0 44233)
>> log scanned up to (0 44233)
131127 03:30:54   innobackupex: All tables locked and flushed to disk

131127 03:30:54   innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI,
innobackupex: .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in
innobackupex: subdirectories of '/var/lib/mysql'
innobackupex: Backing up files '/var/lib/mysql/mysql/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (69 files)
131127 03:30:55   innobackupex: Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files

innobackupex: Resuming ibbackup

xtrabackup: The latest check point (for incremental): '0:44233'
>> log scanned up to (0 44233)
>> log scanned up to (0 44233)
xtrabackup: Stopping log copying thread.
xtrabackup: Transaction log of lsn (0 44233) to (0 44233) was copied.
131127 03:30:58   innobackupex: All tables unlocked
131127 03:30:58   innobackupex: Connection to database server closed

innobackupex: Backup created in directory '/tmp/2013-11-27_03-30-38'
innobackupex: MySQL binlog position: filename '', position 
131127 03:30:58   innobackupex: completed OK!

3、备份结果:
drwxr-xr-x. 4 root root     4096 Nov 27 03:28 2013-11-27_03-27-52
drwxr-xr-x. 4 root root     4096 Nov 27 03:30 2013-11-27_03-30-38

4、指定数据库备份:
[root@localhost bak]# innobackupex --user=root --password=w123123 --ocket=/var/lib/mysql/mysql.sock --defaults-file=/etc/my.cnf --database=testdb /bak
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql               |
| test               |
| testdb             |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop database testdb;
Query OK, 2 rows affected (0.14 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql               |
| test               |
+--------------------+

日志恢复:

[root@localhost bak]# innobackupex   --user=root --password=w123123 --apply-log /bak/2013-11-27_06-14-42/

数据恢复:

[root@localhost bak]# innobackupex   --user=root --password=w123123 --copy-back /bak/2013-11-27_06-14-42/




你可能感兴趣的:(it)