将数据库集群从保留的自动备份还原到指定时间 - Amazon Aurora
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

将数据库集群从保留的自动备份还原到指定时间

如果备份在源集群的保留期内,则可以在删除源数据库集群后,从保留的自动备份中还原数据库集群。该过程类似于从自动备份中还原数据库集群。

注意

您无法使用此过程还原 Aurora Serverless v1 数据库集群,因为不会保留 Aurora Serverless v1 集群的自动备份。

将数据库集群还原到指定时间
  1. 登录 Amazon Web Services Management Console 并通过以下网址打开 Amazon RDS 控制台:https://console.aws.amazon.com/rds/

  2. 在导航窗格中,选择 Automated backups(自动备份)。

  3. 选择已保留选项卡。

    保留的自动备份
  4. 选择要还原的 数据库集群。

  5. 对于 Actions (操作),选择 Restore to point in time (还原到时间点)

    此时会显示还原到时间点窗口。

  6. 选择最近可还原时间以还原到可能的最近时间,或选择自定义来选择时间。

    如果选择 Custom(自定义),请输入要还原集群的指定日期和时间。

    注意

    时间以您的本地时区显示,表示为协调世界时 (UTC) 的偏移量。例如,UTC-5 是东部标准时间/中部夏令时。

  7. 对于数据库集群标识符,请输入还原后的目标数据库集群的名称。名称必须唯一。

  8. 根据需要选择其他选项,例如数据库实例类。

    有关每项设置的信息,请参阅 Aurora 数据库集群的设置

  9. 选择还原到时间点

要将数据库集群还原到指定时间,请使用 Amazon CLI 命令 restore-db-cluster-to-point-in-time 创建新的数据库集群。

您可以指定其他设置。有关每项设置的信息,请参阅 Aurora 数据库集群的设置

此操作支持资源标记。使用 --tags 选项时,将忽略源数据库集群标签,并使用提供的标签。否则,将使用源集群中的最新标签。

对于 Linux、macOS 或 Unix:

aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-resource-id cluster-123ABCEXAMPLE \ --db-cluster-identifier mytargetdbcluster \ --restore-to-time 2017-10-14T23:45:00.000Z

对于 Windows:

aws rds restore-db-cluster-to-point-in-time ^ --source-db-cluster-resource-id cluster-123ABCEXAMPLE ^ --db-cluster-identifier mytargetdbcluster ^ --restore-to-time 2017-10-14T23:45:00.000Z
重要

如果您使用控制台将数据库集群还原到指定时间,则 Amazon RDS 会为您的数据库集群自动创建主实例(写入器)。如果您使用 Amazon CLI 将数据库集群还原到指定时间,则必须明确为数据库集群创建主实例。主实例是在数据库集群中创建的第一个实例。

要为数据库集群创建主实例,请调用 create-db-instance Amazon CLI 命令。包括数据库集群名称以作为 --db-cluster-identifier 选项值。

要将数据库集群还原到指定时间,请结合以下参数调用 Amazon RDS API RestoreDBClusterToPointInTime 操作:

  • SourceDbClusterResourceId

  • DBClusterIdentifier

  • RestoreToTime

重要

如果您使用控制台将数据库集群还原到指定时间,则 Amazon RDS 会为您的数据库集群自动创建主实例(写入器)。如果使用 RDS API 将数据库集群还原到指定时间,请确保为数据库集群明确创建主实例。主实例是在数据库集群中创建的第一个实例。

要为数据库集群创建主实例,请调用 RDS API 操作 CreateDBInstance。包括数据库群集的名称作为 DBClusterIdentifier 参数值。