Database Restoration Solutions with Percona XtraBackup

简介: Create high-availability databases with Alibaba Cloud ApsaraDB for RDS and Percona XtraBackup

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.

Alibaba Cloud ApsaraDB for RDS is a ready-to-use service that handles routine database tasks, freeing you up from database administrative and management tasks. It is compatible with MySQL, SQL Server, and PostgreSQL databases, and is compatible with all Alibaba Cloud products.

In addition to its flexibility, Alibaba Cloud ApsaraDB for RDS supports convenient back up and restoration to ensure stable business operations. ApsaraDB for RDS provides a stable and efficient data backup mechanism, requiring as little as one second for a single operation.

In the next section, I will summarize how to use the restoration tools of ApsaraDB for RDS, in hopes of providing some guidance to those who run into similar issues. Specifically, we will be restoring data using Percona XtraBackup, which is a logical hot backup. Because this tutorial is based on my own practical experience, the actual implementation may vary depending on your device and operating environment.

System Configuration and Properties

Operating Environment

Terminal Operating System: OS X 10.10.4
Server Environment: CentOS 6.5
Local Database Environment: Server version: 5.6.21-log MySQL Community Server (GPL)
Production Database Environment: MySQL5.5

Tools Used

Terminal Tool: iTerm (Mac)
Data Compression and Extract Tool: rds_backup_extract (applicable to RDS only)
Database Restoration Tool: Percona XtraBackup 2.2 Release 2.2.12

Database Backup Procedure

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.

bash rds_backup_extract -f backup.tar.gz/back.xb.gz -C director

2.Install the backup restoration tool: Percona XtraBackup 2.2.

Download the official Percona-XtraBackup [Download address: https://www.percona.com/downloads/XtraBackup/]. The official website offers installers for various platforms. RDS backup uses Version 2.2.9, so we recommend you download Version 2.2.9 or a later version. For more information about the working principles of the tool, refer to the official documentation.

3.Extract backup files.

Extract the backup files by following the instructions in the help documentation:

bash rds_backup_extract -f /home/mysql/backup/hins575175_xtra_20150429091224.tar.gz -C /home/mysql/data

1

4.Restore data using the backup.

Install Percona-XtraBackup before extracting the backup file. Run the following command:

innobackupex --defaults-file=/home/mysql/data/backup-my.cnf --apply-log /home/mysql/data

This step will output the following. If it displays "completed OK", the operations was executed successfully.

2

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:

3

6.Modify the file owner.

Modify the file owner and confirm that the file belongs to the mysql user.

chown -R mysql:mysql /home/mysql/data

4

7.Start the mysqld process and log on for verification.

Start the mysqld process and verify that the startup is successful.

mysqld_safe --defaults-file=/home/mysql/data/backup-my.cnf --user=mysql --datadir=/home/mysql/data &

5

8.Login to MySQL.

6

Note: 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:

delete from mysql.db where user<>'root' and char_length(user)>0;
delete from mysql.tables_priv where user<>'root' and char_length(user)>0;
flush privileges;

Follow Up

That’s it! You have successfully restored your Alibaba Cloud ApsaraDB for RDS database. To learn more about backups on ApsaraDB for RDS, visit the official user guide.

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
目录
相关文章
|
关系型数据库 MySQL Shell
Database Restoration Solutions
Alibaba Cloud ApsaraDB is an on-demand database service that helps you cope with constantly changing business requirements, and frees you up from database administrative and management tasks.
1515 0
|
SQL Oracle 关系型数据库
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
458 2
|
Oracle 关系型数据库
19c 开启Oracle Database Vault
19c 开启Oracle Database Vault
332 1
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
237 1
|
人工智能 Oracle 关系型数据库
一篇文章弄懂Oracle和PostgreSQL的Database Link
一篇文章弄懂Oracle和PostgreSQL的Database Link
|
Oracle 关系型数据库 Linux
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
187 0
|
SQL Oracle 安全
Oracle Database Vault Access Control Components
Oracle Database Vault Access Control Components
145 0
|
Oracle 安全 关系型数据库
What Is Oracle Database Vault?
The Oracle Database Vault security controls protect application data from unauthorized access, and helps you to comply with privacy and regulatory requirements. You can deploy controls to block privileged account access to application data and control sensitive operations inside the database using
108 0
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
636 0
|
Oracle 关系型数据库 数据库
windows Oracle Database 19c 卸载教程
打开任务管理器 ctrl+Shift+Esc可以快速打开任务管理器,找到oracle所有服务然后停止。 停止数据库服务 在开始卸载之前,确保数据库服务已经停止。你可以使用以下命令停止数据库服务: net stop OracleServiceORCL Universal Installer 卸载Oracle数据库程序 一般情况运行Oracle自带的卸载程序,如使用Universal Installer 工具卸载。 点击开始菜单找到Oracle,然后点击Oracle安装产品,再点击Universal Installer。 点击之后稍等一会然后会进入进入下图界面,点击卸载产品。 选中要删除的Orac
1751 1

热门文章

最新文章