如何从一个区域到另一个区域使用 AWS DMS?

How to use AWS DMS from a region to an other?

我正在尝试使用 AWS DMS 将数据从巴黎地区 (eu-west-3) 的源数据库 (AWS RDS MySQL) 移动到爱尔兰的目标数据库 (AWS Redshift)地区( eu-west-1 )。目标是不断复制正在进行的更改。

我 运行 犯了这些错误:

An error occurred (InvalidResourceStateFault) when calling the CreateEndpoint operation: The redshift cluster datawarehouse needs to be in the same region as the current region. The cluster's region is eu-west-1 and the current region is eu-west-3.

文档说:

The only requirement to use AWS DMS is that one of your endpoints must be on an AWS service.

所以我想做的事情应该是可行的。实际上,这似乎是不允许的。

如何从一个区域到另一个区域使用 AWS DMS? 我的端点应该在哪个区域? 我的复制任务应该在哪个地区? 我的复制实例必须与 RDS MySQL 实例位于同一区域,因为它们需要共享一个子网

AWS 提供 this whitepaper,称为 "Migrating AWS Resources to a New AWS Region",去年更新。您可能想联系他们的支持,但一个想法是在迁移到 Redshift 之前将您的 RDS 移动到适当区域中的另一个 RDS。在白皮书中,他们提供了一种迁移 RDS 的替代方法(没有 DMS,如果您出于某种原因不想使用它):

  1. Stop all transactions or take a snapshot (however, changes after this point in time are lost and might need to be reapplied to the target Amazon RDS DB instance).
  2. Using a temporary EC2 instance, dump all data from Amazon RDS to a file:
    • For MySQL, make use of the mysqldump tool. You might want to compress this dump (see bzip or gzip).
    • For MS SQL, use the bcp utility to export data from the Amazon RDS SQL DB instance into files. You can use the SQL Server Generate and Publish Scripts Wizard to create scripts for an entire database or for just selected objects.36
    • Note: Amazon RDS does not support Microsoft SQL Server backup file restores.
    • For Oracle, use the Oracle Export/Import utility or the Data Pump feature (see http://aws.amazon.com/articles/AmazonRDS/4173109646282306).
    • For PostgreSQL, you can use the pg_dump command to export data.
  3. Copy this data to an instance in the target region using standard tools such as CP, FTP, or Rsync.
  4. Start a new Amazon RDS DB instance in the target region, using the new Amazon RDS security group.
  5. Import the saved data.
  6. Verify that the database is active and your data is present.
  7. Delete the old Amazon RDS DB instance in the source region

我找到了我目前正在测试的解决方法。

我将 "Postgres" 声明为 Redshift 集群的引擎类型。它诱使 AWS DMS 认为它是一个外部数据库,并且 AWS DMS 不再检查区域。

我认为这会导致性能下降,因为 DMS 可能会使用 INSERT 而不是 COPY 命令将数据提供给 Redshift。

目前 Redshift 必须与复制实例位于同一区域。

The Amazon Redshift cluster must be in the same AWS account and the same AWS Region as the replication instance.

https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Redshift.html

因此应该在 VPC 内的 Redshift 区域中创建复制实例 然后使用VPC peering使复制实例能够连接到其他区域MySQL实例的VPC

https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html