|
Purpose
By innobackupex full realization of MySQL hot backup
surroundings
OS: CentOS 6.6 32bit
Introduction
Official website: https: //www.percona.com/
Official Download: https: //www.percona.com/downloads/XtraBackup/LATEST/
operating
# Create a directory to store the backup
mkdir / backup
# Starting the backup before the backup Make sure there is enough space.
innobackupex --password = RedHat / backup /
# This is the simplest usage of this command, because I was directly root user backup is omitted --user argument.
# Note that the password is entered here MySQL administrator password, make no mistake, oh.
# If you do not use the root user to back up, then you need to specify the --user argument.
# If your database is not the default configuration file /etc/my.cnf, then you need to use --defaults-file arguments.
# By default, the system automatically creates a timestamp with the current time as a named directory under your specified backup directory, if you want to name your own style, then you can use the --no-timesmtap argument on this parameter when, in the future it may appear in other chapters.
# Note that the best specified datadir in my.cnf file, otherwise when you use this command to back up you may need to use --datadir parameters, recovery is also the same reason, it is best to specify directly in the my.cnf.
After the backup is certainly good # To verify the effect of it (beginners do not take the production environment to test oh).
# To stop the database
service mysqld stop
# Clear the data directory (my data directory is / wwwroot / mysql), be careful not to delete the parent directory mysql.
rm -rf / wwwroot / mysql / *
# Prepare to enter the stage, watch out, here we must select the directory you just backup timestamp.
innobackupex --apply-log / backup / 2015-11-07_14-08-51 /
# Enter the recovery phase
innobackupex --copy-back / backup / 2015-11-07_14-08-51 /
# Authorization
chown -R mysql: mysql / wwwroot / mysql /
# Start Service
service mysqld start
Through the above operations to complete a full backup and restore.
Note that the data directory must be empty to do a complete restore, otherwise it will affect the results of the reduction. |
|
|
|