【问题标题】:Migrating data from live RDS database instance associated with one AWS account to a new RDS database instance associated with another AWS account将数据从与一个 AWS 账户关联的实时 RDS 数据库实例迁移到与另一个 AWS 账户关联的新 RDS 数据库实例
【发布时间】:2021-12-17 12:01:16
【问题描述】:

我正在使用托管在 AWS 上的 Sprint 启动应用程序。应用程序数据存储在 AWS RDS 中。现在我已经设置了另一个 AWS 账户,我想从与当前 AWS 账户关联的 RDS 实例中迁移数据。

在这方面,经过这里的几个帖子,似乎,做同样的步骤如下:

1. Create a snapshot of the database in the RDS database instance associated with the current AWS account.
2. Share the snapshot with the new AWS account.
3. Import the data from this snapshot to the RDS instance associated with the new AWS account.

这种方法的一个问题是:我必须使应用程序对最终用户不可用,直到所有步骤都完成并且具有托管在新 AWS 账户中的数据库的应用程序开始运行,否则总会有还有一些 delta 有待迁移。

但是,我想将数据从现有实例迁移到新实例而不使应用程序对最终用户不可用,但我没有找到任何合适的方法来实现这一点。

有人可以帮忙吗?谢谢。

【问题讨论】:

  • 如果在将 Amazon RDS 数据库实例迁移到另一个账户时担心数据库停机,请使用 AWS Data Migration Services (AWS DMS)。该服务提供数据复制,一般会造成少于 5 分钟的中断时间。

标签: amazon-web-services amazon-rds database-migration


【解决方案1】:

创建一个只读副本

使用停止 MySQL.rds_stop_replication 在只读副本中停止从属

捕获 mysql_binary_log_file_name,mysql_binary_log_file_location

停止实例

拍摄快照

在另一个 AWS 账户中恢复

在 master 中创建复制用户名

在新创建的 RDS 中使用所需值运行以下命令

调用 mysql.rds_set_external_master ( 主机名 , 主机端口 , 复制用户名 ,replication_user_password , mysql_binary_log_file_name , mysql_binary_log_file_location

);

正确移动连接并计划切换

【讨论】:

    【解决方案2】:

    关于如何设置跨账户复制的好文章: https://aws.amazon.com/premiumsupport/knowledge-center/rds-mysql-cross-region-replica/

    另一种方法是使用 AWS Database Migration Services (AWS DMS)。

    您可以创建一个迁移任务,并将原始数据库设置为源端点,将新数据库设置为目标端点。

    接下来使用“完全加载,持续复制”设置创建一个任务。

    一些注意事项:确保在源数据库上启用复制,并且它对 MySQL/MariaDB 使用 RAW bin 日志格式。更多详情:https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html 就我而言,它还损坏了目标表结构。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-25
      • 2013-12-17
      • 1970-01-01
      • 1970-01-01
      • 2017-09-21
      • 2023-03-30
      • 2021-04-19
      • 2017-05-22
      相关资源
      最近更新 更多