简体   繁体   English

定期将数据从AWS RDS(MySQL)复制到另一个服务器(EC2实例)

[英]Replicate Data Regularly from AWS RDS (MySQL) to another Server (EC2 instance)

We have a large AWS RDS(MySQL) Instance and we need to replicate data from it to another Ec2 Instance, daily at a certain time for reporting and analysis purpose. 我们有一个大型的AWS RDS(MySQL)实例,我们需要每天在特定时间将其数据复制到另一个Ec2实例,以进行报告和分析。

currently we are using mysqldump to create a dump file and then copy the whole schema which takes a lot of time. 当前,我们正在使用mysqldump创建一个转储文件,然后复制整个模式,这需要很多时间。 Is there a faster way of doing this, it would be a lot better if it copies only the new records. 有没有一种更快的方法,如果只复制新记录,那就更好了。

How can we copy data without copying whole schema every time? 如何在不每次都复制整个架构的情况下复制数据?

You should look at the Database Migration Service . 您应该查看数据库迁移服务 Don't be confused by the name. 不要被名字弄糊涂了。 It can do continuous or one time replication. 它可以进行连续或一次性复制。 From the FAQ: 从常见问题解答:

Q. In addition to one-time data migration, can I use AWS Database Migration Service for continuous data replication? 问:除了一次性数据迁移之外,我是否可以使用AWS Database Migration Service进行连续数据复制?

Yes, you can use AWS Database Migration Service for both one-time data migration into RDS and EC2-based databases as well as for continuous data replication. 是的,您可以使用AWS Database Migration Service将数据一次性迁移到基于RDS和EC2的数据库中,也可以进行连续数据复制。 AWS Database Migration Service will capture changes on the source database and apply them in a transactionally-consistent way to the target. AWS Database Migration Service将捕获源数据库上的更改,并以事务一致的方式将其应用于目标。 Continuous replication can be done from your data center to the databases in AWS or in the reverse, replicating to a database in your datacenter from a database in AWS. 可以从您的数据中心到AWS中的数据库进行连续复制,或者相反,可以从AWS中的数据库复制到您的数据中心中的数据库。 Ongoing continuous replication can also be done between homogeneous or heterogeneous databases. 在同构或异类数据库之间也可以进行持续的复制。 For ongoing replication it would be preferable to use Multi-AZ for high-availability. 对于正在进行的复制,最好使用Multi-AZ以获得高可用性。

You can use AWS Glue to do the database migration as an ETL job periodically. 您可以使用AWS Glue作为ETL作业定期进行数据库迁移。

You can also consider using AWS Data Migration Service (DMS). 您也可以考虑使用AWS Data Migration Service(DMS)。

However AWS Glue is preferred over DMS for ETL jobs that runs within AWS and you are familiar with Python or Scala to write the transformation logic. 但是,对于在AWS内运行的ETL作业,AWS Glue优于DMS,并且您熟悉Python或Scala来编写转换逻辑。

Q: When should I use AWS Glue vs AWS Database Migration Service? 问:何时应使用AWS Glue vs AWS Database Migration Service? AWS Database Migration Service (DMS) helps you migrate databases to AWS easily and securely. AWS Database Migration Service(DMS)可帮助您轻松,安全地将数据库迁移到AWS。 For use cases which require a database migration from on-premises to AWS or database replication between on-premises sources and sources on AWS, we recommend you use AWS DMS. 对于需要将数据库从本地迁移到AWS或在本地源与AWS上的源之间进行数据库复制的用例,建议您使用AWS DMS。 Once your data is in AWS, you can use AWS Glue to move and transform data from your data source into another database or data warehouse, such as Amazon Redshift. 将数据保存在AWS中后,您可以使用AWS Glue将数据从数据源移动和转换到另一个数据库或数据仓库中,例如Amazon Redshift。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM