Statement
The Stars last night
Blog:http://yestreenstars.blog.51cto.com/
This article by oneself creation, if need reprint, please indicate source, thank cooperation!
Objective
Full hot backup of MySQL with Innobackupex
Environment
Os:centos 6.6 32bit
Introduced
Official website: https://www.percona.com/
Official: https://www.percona.com/downloads/XtraBackup/LATEST/
Operation
# create a directory to hold the backup mkdir /backup# start the backup, make sure you have enough space before backing up. innobackupex --password=redhat /backup/# This is the simplest use of this command, because I am backing up directly with the root user, so I omit the--user parameter. # Note that the password entered here is the MySQL administrator password, do not mistake oh. # If you are not using the root user to back up, you will need to specify the--user parameter. # If your database configuration file is not the default/ETC/MY.CNF, then you need to specify it with the--defaults-file parameter. # by default, the system automatically creates a directory named after the current time stamp in the backup directory you specify, and if you want to name it in your own style, you can use the--no-timesmtap parameter, which may later appear in other chapters for this parameter. # Note that it is a good idea to specify DataDir in the my.cnf file, otherwise you might need to use the--datadir parameter when you use the command backup, so it is best to specify it directly in MY.CNF. # after the backup is of course to verify the effect (beginners do not take the production environment to test OH). # Stop the database service mysqld stop# empty the data directory (my Data directory is/wwwroot/mysql), be careful not to delete the parent directory MySQL. rm -rf /wwwroot/mysql/*# into the prepare phase, note that you must select the time stamp directory you just backed up. innobackupex --apply-log /backup/2015-11-07_14-08-51/# into recovery phase Innobackupex --copy-back /backup/2015-11-07_14-08-51/# Authorized chown -r mysql:mysql /wwwroot/mysql/# Start Service Service mysqld start
A full backup and restore is completed with the above operation.
Note that you must clear the data directory when you do a full restore, otherwise it will affect the result of the restore.
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1710586
Full hot backup of MySQL with Innobackupex