Special reminder before backup:
1.In the backupMySQLDatabaseMy. cnfFile,RequiredDatadir = {PATH },Otherwise, the path of the backup data cannot be found..
2.During the backup processINNODBAfter the data file is backed up, the entire database is locked and copied.MYISAMNon-transaction engine data and. FrmFor our system,Only1-2In seconds.
A.Full database backup
Command:
Innobackupex-1.5.1 -- user = root -- password = root -- database = total2 -- defaults-file =/home/mysql-server/mysql3/my. cnf/home/mysql-server/backup
Parameter description:
Innobackupex-1.5.1:For EncapsulationXtrabackupOfPerlScript.BecauseXtranbackupItself cannot be backed upMyISAMTable.Use this built-in script.You can back up the data together..
User:Database connection username
Password:Database connection password
Database:Database to be backed up
Defaults-file:Path of the backup database configuration file
/Home/mysql-server/backup:This is a custom path for storing backup files.
Note:-- Slave-info: add this parameter on the slave machine to record the pos point of the master machine.
B1.Incremental Backup details
Command: (the first Incremental Backup)
Innobackupex-1.5.1 -- user = root -- password = root -- database = total2 -- defaults-file =/home/mysql-server/mysql3/my. cnf-incremental -- incremental-basedir =/home/mysql-server/backup/2012-02-21_20-14-05/Home/mysql-server/backup/
Parameter description:
-Incremental:Indicates that this backup is an incremental backup..
-- Incremental-basedir:Specifies the location of the previous full backup or Incremental backup file. The Incremental backup at www.bkjia.com is only for InnoDB. For MyISAM, it is still a full backup. (Here/Home/mysql-server/backup/2012-02-21_20-14-05Indicates the path of the complete backup..Write this path. XtrabackupBased onLSNIncremental Backup)
/Home/mysql-server/backup/:This is a custom path for storing backup files.(For example:The last backup file is named2012-02-21_ 20_50_04)
B2.Incremental Backup details
Command: (the second Incremental Backup)
Innobackupex-1.5.1 -- user = root -- password = root -- database = total2 -- defaults-file =/home/mysql-server/mysql3/my. cnf -- incremental-basedir =/home/mysql-server/backup/2012-02-21_20_50_04/Home/mysql-server/backup/
Parameter description:
-- Incremental-basedir: You can watch,The file name of this Incremental backup is,File Name of the first Incremental Backup(Will get the first Incremental BackupLSNContinue backup)
C.Restore the entire database
Restore,Special,Special attention...
#===================================================== ====================
To delete the database to be restoredDatadirAll data in the specified path.It must be an empty file.
Even if your system library is in it, you should firstMvCome out.For example: Mysql, performance_schema, testThen
#===================================================== ========================
Command1:
Innobackupex-1.5.1 -- user = root -- password = root -- database = total2 -- defaults-file =/home/mysql-server/mysql2/my. cnf-- Apply-log/home/mysql-server/backup/2012-02-21_20-14-05
Parameter description:
Apply-log:Because it is online during Backup,If a newly insertedSQLStatement,Will record the newly addedLSNPoint,And put it in the backup file.Xtrabackup_logfileMedium,Used for restoration-- Apply-logTo release the Hot Backup modification page,Put in tablespace.
/Home/mysql-server/backup/2012-02-21_20-14-05:This must be the path of the backup file..
Command2:
Innobackupex-1.5.1 -- user = root -- password = root -- database = total2 -- defaults-file =/home/mysql-server/mysql2/my. cnf -- copy-back/home/mysql-server/backup/2012-02-21_20-14-05
Parameter description:
Copy-back: this parameter indicates restoration.
#===================================================== ======================================
1.Back up the system library firstMVTo the original place
2.ModifyDataDirectory permission(If you setMySQLUser Access)
Chown-R mysql. mysql data
#===================================================== ========================================