Using innobackupex to implement full MySQL Hot Backup
Purpose
Using innobackupex to implement full MySQL Hot Backup
Environment
OS: CentOS 6.6 32bit
Introduction
Official Website: https://www.percona.com/
Https://www.percona.com/downloads/XtraBackup/LATEST/
Operation
# Create a directory for storing backups
Mkdir/backup
# Start backup. Make sure there is sufficient space before backup.
Innobackupex -- password = RedHat/backup/
# This is the simplest use of this command, Because I directly use root user backup, so the -- user parameter is omitted.
# Note: The password entered here is the MySQL administrator password. Do not make a mistake.
# If you are not using the root user for backup, you need to specify the -- user parameter.
# If your database configuration file is not the default/etc/my. cnf file, you need to use the -- defaults-file parameter to specify it.
# By default, the system will automatically create a directory named after the current time in the backup directory you specified. If you want to name it in your own style, you can use the -- no-timesmtap parameter. The parameter may appear in other chapters in the future.
# Note: it is best to visit my. specify datadir In the cnf file. Otherwise, you may need to use the -- datadir parameter when using this command for backup. The same is true for recovery. Therefore, it is best to directly use datadir in my. cnf.
# After the backup is complete, verify the effect (do not test the production environment for beginners ).
# Stop the database first
Service mysqld stop
# Clear the data directory (my data directory is/wwwroot/mysql). Be sure not to delete the parent directory mysql.
Rm-rf/wwwroot/mysql /*
# Enter the prepare stage. Note that you must select the timestamp directory you just backed up.
Innobackupex -- apply-log/backup/2015-11-07_14-08-51/
# Entering the recovery phase
Innobackupex -- copy-back/backup/2015-11-07_14-08-51/
# Authorization
Chown-R mysql: mysql/wwwroot/mysql/
# Start the service
Service mysqld start
After performing the preceding operations, a complete backup and restoration are completed.
Note: The data directory must be cleared during full restoration; otherwise, the restoration result may be affected.
XtraBackup and InnoBackupex online backup
Using innobackupex to back up a single MySQL database
This article permanently updates the link address: