As your business progresses, database requirements will inevitably change and grow. Manually creating and maintaining database servers is no longer a viable approach for most business applications. Instead, enterprises nowadays need an on-demand database service to cope with the constantly changing business requirements.
<b>Terminal Operating System</b>: OS X 10.10.4
<b>Server Environment</b>: CentOS 6.5
<b>Local Database Environment</b>: Server version: 5.6.21-log MySQL Community Server (GPL)
<b>Production Database Environment</b>: MySQL5.5
<b>Terminal Tool</b>: iTerm (Mac)
<b>Data Compression and Extract Tool</b>: rds_backup_extract (applicable to RDS only)
<b>Database Restoration Tool</b>: Percona XtraBackup 2.2 Release 2.2.12
1.Download the RDS official extract tool kit: rds_backup_extract.
An RDS backup file is a compressed package. It must be extracted first. Download the extract tool hererds_backup_extract (sh file). Currently, the tool kit only supports 64-bit Linux systems.
<code>bash rds_backup_extract -f backup.tar.gz/back.xb.gz -C director</code>
2.Install the backup restoration tool: Percona XtraBackup 2.2.
3.Extract backup files.
Extract the backup files by following the instructions in the help documentation:
<code>bash rds_backup_extract -f /home/mysql/backup/hins575175_xtra_20150429091224.tar.gz -C /home/mysql/data</code>
4.Restore data using the backup.
Install Percona-XtraBackup before extracting the backup file. Run the following command:
<code>innobackupex --defaults-file=/home/mysql/data/backup-my.cnf --apply-log /home/mysql/data</code>
This step will output the following. If it displays "completed OK", the operations was executed successfully.
5.Configure the environment.
Due to version issues, comment out innodb_fast_checksum, innodb_page_size and innodb_log_block_size in backup-my.cnf in the extracted files, as shown in the figure below:
6.Modify the file owner.
Modify the file owner and confirm that the file belongs to the mysql user.
<code>chown -R mysql:mysql /home/mysql/data</code>
7.Start the mysqld process and log on for verification.
Start the mysqld process and verify that the startup is successful.
<code>mysqld_safe --defaults-file=/home/mysql/data/backup-my.cnf --user=mysql --datadir=/home/mysql/data &</code>
8.Login to MySQL.
<b>Note</b>: After the restoration, the mysql.user table does not contain users created in the RDS. You need to create new users.
Prior to creating new users, execute the following SQL statements: