×
Community Blog How to Restore RDS Database from Backup Files

How to Restore RDS Database from Backup Files

In this article, you will learn how to restore RDS database from backup files with RDS official extract tool kit and Percona XtraBackup.

Restoration 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 here rds_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 directory

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

RDS backup uses Version 2.2.9, so we recommend you download Version 2.2.9 or a later version.

3. Extract backup files

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

4. Restore data using the backup file

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

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.

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

7. Start the mysqld process and log on for verification

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

8. Execute the following SQL statements and then create new users as the mysql.user table does not contain users created in the RDS:

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;

For details, you can go to Database Backup and Restoration Solutions.

Related Documentation

Back up RDS data

You can configure a backup policy to adjust the cycles of RDS data backup and log backup. As a result, RDS enables the auto-backup feature. You can also manually back up RDS data.

Instance backup files occupy backup space. Charges are incurred if the used space exceeds the free quota. You must set a backup cycle appropriately to cater to the service requirements based on the available backup space.

ApsaraDB supports data backup and log backup. To recover data to a point in time, you must enable the log backup function.

And you will also learn the backup policies and how to configure automatic backup and manual backup in this document.

Create backup - ApsaraDB for RDS

Create backups. Up to 10 backups can be created for an instance in a single day. The following conditions must be met, otherwise backup creation will fail:

  1. The instance is active.
  2. The last backup has been completed.

Modify the backup policy

This API is used to modify the backup policy. The RDS system periodically backs up instances according to the user-defined system configuration.

Related Blog Posts

Backing Up and Restoring Databases with Alibaba Cloud Database Backup Service

Alibaba Cloud Database Backup Service (DBS) is a secure and cost-efficient solution for continuous data protection. The service offers strong protection for data stored in multiple environments, such as enterprise data centers, hybrid clouds, public clouds, and third-party cloud vendors.

In this article, we will show you how to make use of the new Database Backup Service to perform database backup and restore process.

Using XtraBackup for Physical Backup and Restoration

This article mainly introduces the principles of MySQL database backup and restoration, so that you can better understand the ApsaraDB for RDS backup and restoration mechanisms. Specifically, we will be exploring how to create physical and logical backups on ApsaraDB for RDS using mysqldump, Percona XtraBackup, and innobackupex.

If you are not familiar with these two types of backups, then you should definitely read up about them, as these two backups can be crucial to maintaining stable business operations. Basically, physical backup is just a physical copy stored in another location by merely copying files. This can be done through a hot backup or a cold backup. Logical backup on the other hand focuses storing data elements, and can be useful when it comes to more granular recovery. Instead of focusing on the differences of these two backups, you should focus on integrating them to provide a more robust backup solution.

ApsaraDB for RDS uses mysqldump to logically back up data to the MySQL database. XtraBackup can be used for a full physical backup at the instance level.

Database Celebration Offers

Alibaba Cloud Database Service has been recognized as A Strong Performer by Forrester. To celebrate the achievement and progress made by Alibaba Cloud database, we are now giving out attractive offers exclusively for our customers. Please refer to the Terms and Conditions section for details and rules of the offers.

0 0 0
Share on

Alibaba Clouder

2,599 posts | 764 followers

You may also like

Comments