Database Restoration Solutions

Abstract

As your business progresses, database requirements will inevitably change and grow. 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. In addition to its flexibility, Alibaba Cloud ApsaraDB supports convenient back up and restoration to ensure stable business operations. ApsaraDB 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. Because this tutorial is based on my own practical experience, the actual implementation may vary depending on your device and operating environment.

Operating environment

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

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.

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

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.

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.
chown -R mysql:mysql /home/mysql/data

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 &

login MySQL

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;

That's it! You have successfully restored your ApsaraDB for RDS database.

时间: 2024-10-25 05:27:56

Database Restoration Solutions的相关文章

Oracle SQL tuning 数据库优化步骤图文教程

  SQL Turning 是Quest公司出品的Quest Central软件中的一个工具.Quest Central是一款集成化.图形化.跨平台的数据库管理解决方案,可以同时管理 Oracle.DB2 和 SQL server 数据库. 一.SQL Tuning for SQL Server简介 SQL语句的优化对发挥数据库的最佳性能非常关键.然而不幸的是,应用优化通常由于时间和资源的因素而被忽略.SQL Tuning (SQL优化)模块可以对比和评测特定应用中SQL语句的运行性能,提出智能

Oracle SQL tuning 数据库优化步骤分享(图文教程)_oracle

SQL Turning 是Quest公司出品的Quest Central软件中的一个工具.Quest Central是一款集成化.图形化.跨平台的数据库管理解决方案,可以同时管理 Oracle.DB2 和 SQL server 数据库. 一.SQL Tuning for SQL Server简介 SQL语句的优化对发挥数据库的最佳性能非常关键.然而不幸的是,应用优化通常由于时间和资源的因素而被忽略.SQL Tuning (SQL优化)模块可以对比和评测特定应用中SQL语句的运行性能,提出智能化的

The Evolution of Blockchain Development

Introduction Blockchain is a distributed peer-to-peer network without any central control points. It uses distributed unified operation to achieve a set of tamper-resistant and trusted database technical solutions. It also features decentralized stor

kdb+ The high-performance database that sets the standard for time-series analytics

KDB商业数据库, 虽然商业, 但是从介绍来看, 是比较强大的, 在金融行业用得比较多. 号称内建MAP/REDUCE支持, 可以轻松扩展到多PB容量. 想学习的朋友可以下载学习版, 学习一下Q语言的使用. http://kx.com/software-download.php Kx offers kdb+, a high-performance column-store database with a built-in expressive query and programming lang

Database Recovery in GitLab – Implementing Database Disaster Tolerance &amp; High Availability

How can we restore an accidentally deleted database in GitLab? How can we implement database backup, recovery, disaster tolerance, and high availability? If you are in the database industry, you might be more concerned about these issues recently. La

Data Migration Pre-Check Failures and Solutions

Abstract Alibaba Cloud Data Transmission Service supports data transmission between database-centered structured storage products. It integrates a wide variety of data transmission capabilities, including data migration, data subscription, and real-t

Using XtraBackup for Physical Backup and Restoration

Abstract: Xtrabackup is a MySQL database backup tool provided by Percona. According to the official introduction, "Percona XtraBackup is the world's only open-source, free MySQL hot backup software that performs non-blocking backups for InnoDB and Xt

Database Tuning Best Practices - A Success Story

Introduction SaaS service providers must always consider the large number of users when designing an appropriate business architecture. The large user base and massive user data require both efficiency and stability in the infrastructure construction

Implementing Effective MySQL Database Backup Mechanisms

Data reliability is crucial for the stability of business systems. Despite the advancements in data reliability technologies, enterprises should not ignore the importance of backing up data. Alibaba Cloud ApsaraDB for RDS for MySQL helps you easily c