xtrabackup Backup + Restore abbreviated

1, the installation
Download: https: //www.percona.com/downloads/Percona-XtraBackup-LATEST/

2, the backup
# innobackupex --defaults-file = / data / mysql / mysql3307 / my3307.cnf -S /tmp/mysql3307.sock -proot --stream = tar ./ | gzip -> `date +% F% H% % S`.tar.gz M
--defaults file is data to be backed-profile path
/tmp/mysql3307.sock -> path sock is
proot -> the password, the password is the root
--stream the tar ./ = | gzip -> `date +% F% H% M% S`.tar.gz -> backup compression, using tar mode, the current time to the backup file in the current directory .tar.gz

3, restore
if the backup file is out of the [2019-03-26092718.tar.gz]

3.1 decompression
# mkdir 2019-03-26092718 && tar -zxvf 2019-03-26092718.tar.gz -C 2019-03-26092718 /

3.2 Record current backup binlog file and its position to the point
# cd 2019-03-26092718 /
# CAT xtrabackup_binlog_info
MySQL-binlog.000181 12,921,798 ##-binlog.000181 MySQL binlog file name to backup, the backup to the position 12,921,798 points

3.3 execution apply-log, application Rodo
# innobackupex --apply-log ./

3.4 implementation of copy-back
here began to copy the backup files to a place about to restore the backup, there will need to submit a good backup configuration will be restored cnf file
# innobackupex --defaults-file = / data / mysql / mysql3306 / my3306.cnf - Back-Copy / the root / 2019-03-26092718 /
# chown -R & lt MySQL: MySQL / Data /

3.5 Start
/ usr / local / mysql / bin / mysqld --defaults-file = / data / mysql / mysql3306 / my3306.cnf &
here the entire backup and recovery on all completed.

Guess you like

Origin www.linuxidc.com/Linux/2019-10/161013.htm