Database Restoration Solutions

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: 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.

Hive

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

02

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.

03

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:

04

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

05

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 &

06_1

login MySQL

06_2

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.

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
MySQL 关系型数据库 Shell
Database Restoration Solutions with Percona XtraBackup
Create high-availability databases with Alibaba Cloud ApsaraDB for RDS and Percona XtraBackup
2660 0
Database Restoration Solutions with Percona XtraBackup
|
1月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
71 0
|
4月前
|
Oracle 关系型数据库 数据库
windows Oracle Database 19c 卸载教程
打开任务管理器 ctrl+Shift+Esc可以快速打开任务管理器,找到oracle所有服务然后停止。 停止数据库服务 在开始卸载之前,确保数据库服务已经停止。你可以使用以下命令停止数据库服务: net stop OracleServiceORCL Universal Installer 卸载Oracle数据库程序 一般情况运行Oracle自带的卸载程序,如使用Universal Installer 工具卸载。 点击开始菜单找到Oracle,然后点击Oracle安装产品,再点击Universal Installer。 点击之后稍等一会然后会进入进入下图界面,点击卸载产品。 选中要删除的Orac
105 1
|
5月前
|
存储 Oracle 关系型数据库
windows 使用 Oracle Database 19c
Oracle数据库是由美国Oracle Corporation(甲骨文公司)开发和提供的一种关系型数据库管理系统,它是一种强大的关系型数据库管理系统(RDBMS)。它使用表格(表)组织和存储数据,通过SQL语言进行数据管理。数据以表格形式存储,表之间可以建立关系。支持事务处理、多版本并发控制、安全性和权限控制。具有高可用性、容错性,支持分布式数据库和可扩展性。Oracle Corporation提供全面的支持和服务,使其成为企业级应用的首选数据库系统。
57 0
|
10月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2(下)
服务器Centos7 静默安装Oracle Database 12.2(下)
235 0
|
10月前
|
Oracle 安全 关系型数据库
服务器Centos7 静默安装Oracle Database 12.2(上)
服务器Centos7 静默安装Oracle Database 12.2(上)
91 0
|
10月前
|
存储 Oracle 关系型数据库
|
12月前
|
机器学习/深度学习 存储 Oracle
Oracle win32_11gR2_database在Win7下的安装与卸载
Oracle win32_11gR2_database在Win7下的安装与卸载
142 0
|
12月前
|
Oracle 关系型数据库 Linux
Oracle 11gR2_database在Linux下的安装
Oracle 11gR2_database在Linux下的安装
84 0

热门文章

最新文章