未加星标

Migrate MySQL data to RDS/Aurora Using Xtrabackup

字体大小 | |
[数据库(mysql) 所属分类 数据库(mysql) | 发布者 店小二04 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

In this blog, I will provide a step by step procedure to migrate from on-premise mysql to Amazon RDS/Aurora using Percona-xtrabackup

Both RDS and Aurora is a DBAAS provided by Amazon. To know more on DBAAS you can view ourpresentation here.

When you are having a database in size of few GB, it would be very convenient to take a logical backup using a logical backup tool such as Mysqldump or Mydumper and restore it Amazon RDS/Aurora easily. But this is not the case when you are having a data size of a few hundred GB or TB, Where the logical backup and restore is very painful and time-consuming. To overcome this we can use Xtrabackup ( open source hot backup ).

AWS started supporting Xtrabackup restore for Aurora MySQL long time ago and is Supporting RDS from the last few months back, Both follow the same procedure, hence am using RDS for the purpose of restore, since Aurora is on costlier side.

Production Use Case:

Recently I had come across a situation of restoring xtrabackup to Aurora of data size 300GB and it worked like a charm and the data was absolutely fine and also data was restored in 2 hours.

Before going into the demo, first, let us see the limitations in this method

Limitations:

ArchitectureStreaming backup directly to S3:

The below command to stream the backup directly to S3 bucket, if you are low on local backup space streaming directly avoids the usage of local storage, also make sure to have a strong network pipe.

# xtrabackup --user=root --password='S3cret!123' --backup --stream=tar | gzip -c | s3cmd put - s3://kabileshs3/xtrabackup56.tar.gz

RDS/Aurora also supports the creation of instance from a tar compressed format and also the S3 footprint can be reduced by compressing the backup, Ensure the compressed backup size should not exceed 5TB, this is the max object size supported by S3.

Backup is now uploaded to s3

Creating RDS instance:

Go to RDS console as below


Migrate MySQL data to RDS/Aurora Using Xtrabackup

Click “Restore a database instance from Amazon S3”

Select engine to be used with the restored instance, Am using MySQL, You can select Aurora based on your use-case.


Migrate MySQL data to RDS/Aurora Using Xtrabackup

Next Specify source backup details ie, S3 and its details


Migrate MySQL data to RDS/Aurora Using Xtrabackup

Create a new IAM role for RDS to access the s3 bucket to make the access and restore of the backup


Migrate MySQL data to RDS/Aurora Using Xtrabackup

Now the last and the final step proceed to Specify the DB details such as the instance size, engine version as shown in the below screenshot.


Migrate MySQL data to RDS/Aurora Using Xtrabackup
Migrate MySQL data to RDS/Aurora Using Xtrabackup

Next choose the backup retention, VPC and security group for accessing the DB instance.

Now click next your instance is getting ready


Migrate MySQL data to RDS/Aurora Using Xtrabackup

It took around some 20 mins to get instance ready


Migrate MySQL data to RDS/Aurora Using Xtrabackup

In the above restore we have just used data, from sysbench so it shouldn’t be an issue, let’s check the data consistency, By checking the count between the source instance and the restored RDS instance as shown below.


Migrate MySQL data to RDS/Aurora Using Xtrabackup
Migrate MySQL data to RDS/Aurora Using Xtrabackup

Hope you have enjoyed and learned, Also share your much valued feedback.

Image Courtesy:Photo by Gareth Davies on Unsplash

本文数据库(mysql)相关术语:navicat for mysql mysql workbench mysql数据库 mysql 存储过程 mysql安装图解 mysql教程 mysql 管理工具

代码区博客精选文章
分页:12
转载请注明
本文标题:Migrate MySQL data to RDS/Aurora Using Xtrabackup
本站链接:https://www.codesec.net/view/621254.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mysql) | 评论(0) | 阅读(63)