A.1Full database backup.
Command:
Mysqlbackup-- Defaults-file =/home/mysql-server/mysql3/my. cnf -- user = root -- password = root -- databases = "mysql total2" -- with-timestamp -- backup-dir =/home/mysql-server/backup
Parameter description:
-- Defaults-fileMy. cnfFile Path,It is mainly used for multiple servers.MysqlService.The default position is/Etc/my. cnf
-- UserUser Name,This user must beMysqlThe library has been created.TableAnd Query,Insert permission.During the backup process. MysqlbackupTheMysqlCreate under libraryBackup_history, backup_progressTable.The user retains historical backup information and basic backup information..
-- PasswordPassword
-- DatabaseDatabase to be backed up,To back up multiple databases, you must use""Include,Separate each database with spaces
-- With-timestampThe user creates a folder at the current time under the Backup Directory,If you do not have this parameter,Multiple backups,Create the same directory,Overwrites the last backup file..
-- Backup-dirBackup Directory
BackupIndicates,This is a backup operation.
A.2Full database Restoration.
Step 1:Transaction Log Detection
Mysqlbackup -- defaults-file =/home/mysql-server/mysql2/my. cnf-- Backup-dir =/home/mysql-server/backup/2012-03-21_14-01-34/apply-log
Parameter description:
Apply-log:Because it is online during Backup,If a newly insertedSQLStatement,Will record the newly addedLSNPoint,Then the newly modified page will be placed in this file (Ibbackup_logfile),It will also be placed in the tablespace..When this parameter is used for restoration, MysqlbackupWill detectIbbackup_logfileAnd tablespaceLSNPoint,Then compareIbbackup_logfileFile tablespaceLSNDifference,Put this value in the transaction logLOGInside.(If the transaction log is full,Will enter the tablespace)
Step 2: CopyPhysical files
Mysqlbackup -- defaults-file =/home/mysql-server/mysql2/my. cnf-- Backup-dir =/home/mysql-server/backup/2012-03-21_14-01-34/-- innodb_log_files_in_group = 2 copy-back
B .1Compressing full-Database Backup
Mysqlbackup-- Defaults-file =/home/mysql-server/mysql3/my. cnf -- user = root -- password = root -- compress-level = 1 -- databases = "mysql total2" -- with-timestamp -- backup-dir =/home/mysql-server/backup
Parameter description:
-- Compress-level = 1
1For quick Compression.Total9Levels
B .2Compression and Restoration
Step 1:Transaction Log Detection,Decompress the package
Mysqlbackup -- defaults-file =/home/mysql-server/mysql2/my. cnf -- uncompress -- backup-dir =/home/mysql-server/backup/2012-03-21_14-08-33/apply-log
UncompressDecompress the compressed file.
Step 2: CopyPhysical files
Mysqlbackup -- defaults-file =/home/mysql-server/mysql2/my. cnf -- innodb_log_files_in_group = 2 -- backup-dir =/home/mysql-server/backup/2012-03-21_14-08-33/Copy-back
Incremental backup does not support Compression. Backup-and-apply-logParameters cannot match-- Compress-levelSame purpose