使用了新的Mysql恢复备份工具,再此略记一下。
下次部署到线上。
安装超级简单:
rpm -ivh percona-xtrabackup-2.0.2-461.rhel5.x86_64.rpm
备份命令:
innobackupex --defaults-file=my.cnf /data/datamysql/backups/
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.
120823 12:45:03 innobackupex: Starting mysql with options: --defaults-file='my.cnf' --unbuffered --
120823 12:45:03 innobackupex: Connected to database with mysql child process (pid=20948)
120823 12:45:09 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.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1
innobackupex: Using mysql server version Copyright (C) 2000-2008 MySQL AB
innobackupex: Created backup directory /data/datamysql/backups/2012-08-23_12-45-09
120823 12:45:09 innobackupex: Starting mysql with options: --defaults-file='my.cnf' --unbuffered --
120823 12:45:09 innobackupex: Connected to database with mysql child process (pid=20975)
120823 12:45:11 innobackupex: Connection to database server closed
120823 12:45:11 innobackupex: Starting ibbackup with command: xtrabackup_51 --defaults-file="my.cnf" --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/data/datamysql/backups/2012-08-23_12-45-09
innobackupex: Waiting for ibbackup (pid=20988) to suspend
innobackupex: Suspend file '/data/datamysql/backups/2012-08-23_12-45-09/xtrabackup_suspended'
xtrabackup_51 version 2.0.2 for MySQL server 5.1.59 unknown-linux-gnu (x86_64) (revision id: 461)
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 1400603920)
[01] Copying ./ibdata1 to /data/datamysql/backups/2012-08-23_12-45-09/ibdata1
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
[01] ...done
>> log scanned up to (0 1400603920)
120823 12:45:57 innobackupex: Continuing after ibbackup has suspended
120823 12:45:57 innobackupex: Starting mysql with options: --defaults-file='my.cnf' --unbuffered --
120823 12:45:57 innobackupex: Connected to database with mysql child process (pid=21082)
120823 12:45:59 innobackupex: Starting to lock all tables...
>> log scanned up to (0 1400603920)
>> log scanned up to (0 1400603920)
120823 12:46:09 innobackupex: All tables locked and flushed to disk
120823 12:46:09 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 file '/var/lib/mysql/info/asd.frm'
innobackupex: Backing up file '/var/lib/mysql/info/db.opt'
innobackupex: Backing up files '/var/lib/mysql/mysql/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (51 files)
innobackupex: Backing up files '/var/lib/mysql/BugFree/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (38 files)
innobackupex: Backing up file '/var/lib/mysql/test/c.MYD'
innobackupex: Backing up file '/var/lib/mysql/test/b.MYD'
innobackupex: Backing up file '/var/lib/mysql/test/b.frm'
innobackupex: Backing up file '/var/lib/mysql/test/b.MYI'
innobackupex: Backing up file '/var/lib/mysql/test/c.frm'
innobackupex: Backing up file '/var/lib/mysql/test/a.frm'
innobackupex: Backing up file '/var/lib/mysql/test/c.MYI'
innobackupex: Backing up files '/var/lib/mysql/wikidb/*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (38 files)
120823 12:46:10 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:1400603920'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (0 1400603920)
xtrabackup: Transaction log of lsn (0 1400603920) to (0 1400603920) was copied.
120823 12:46:12 innobackupex: All tables unlocked
120823 12:46:12 innobackupex: Connection to database server closed
innobackupex: Backup created in directory '/data/datamysql/backups/2012-08-23_12-45-09'
innobackupex: MySQL binlog position: filename '', position
120823 12:46:12 innobackupex: completed OK!