还原 Aurora Serverless v1 数据库集群 - Amazon Aurora
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

还原 Aurora Serverless v1 数据库集群

您可以在使用 Aurora Serverless v1、Amazon Web Services Management Console 或 RDS API 还原预置数据库集群快照时配置 Amazon CLI 数据库集群。

在将快照还原到 Aurora Serverless v1 数据库集群时,您可以设置以下特定值:

  • Minimum Aurora capacity unit (最小 Aurora 容量单元) – Aurora Serverless v1 可以将容量减少到该容量单元。

  • Maximum Aurora capacity unit (最大 Aurora 容量单元) – Aurora Serverless v1 可以将容量增加到该容量单元。

  • 超时操作 – 当容量修改操作因找不到扩展点而超时时要执行的操作。Aurora Serverless v1如果设置了 Force scaling the capacity to the specified values... (强制将容量扩展至指定值…) 选项,数据库集群就可以强制数据库集群使用新的容量设置。或者,如果您不选择该选项,它将可以回滚容量更改以取消它。有关更多信息,请参阅“容量更改超时操作”。

  • 不活动后暂停 – 从无数据库流量到缩减到零处理容量之间的时间长度。当数据库流量恢复后,Aurora 将自动恢复处理容量并进行扩展以处理流量。

有关从快照还原数据库集群的一般信息,请参阅从数据库集群快照还原

您可以使用Amazon Web Services Management Console将数据库集群快照还原为 Aurora 数据库集群。

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

  2. 在 Amazon Web Services Management Console 的右上角,选择托管源数据库集群的 Amazon Web Services 区域。

  3. 在导航窗格中,选择 Snapshots(快照),然后选择要还原的数据库集群快照。

  4. 对于 Actions (操作),选择 Restore Snapshot (还原快照)

  5. Restore DB Cluster (还原数据库集群) 页面上,为 Capacity type (容量类型) 选择 Serverless (无服务器)

    
                                使用控制台还原 Aurora Serverless v1 数据库集群。
  6. DB cluster identifier (数据库集群标识符) 字段中,键入还原的数据库集群的名称,然后填写其他字段。

  7. Capacity settings (容量设置) 部分中,修改扩展配置。

    
                使用控制台设置 Aurora Serverless v1 数据库集群的最小容量和最大容量
  8. 选择 Restore DB Cluster (还原数据库集群)

要连接到 Aurora Serverless v1 数据库集群,请使用数据库终端节点。有关详细信息,请参阅连接到 Amazon Aurora 数据库集群中的说明。

注意

如果遇到以下错误消息,您的账户则需要额外的权限:

Unable to create the resource. Verify that you have permission to create service linked role. Otherwise wait and try again later.

有关更多信息,请参阅将服务相关角色用于 Amazon Aurora

您可以在使用 Amazon Web Services Management Console、Amazon CLI 或 RDS API 还原预置数据库集群快照时配置 Aurora Serverless 数据库集群。

在将快照还原到 Aurora Serverless 数据库集群时,您可以设置以下特定值:

  • Minimum Aurora capacity unit (最小 Aurora 容量单元) – Aurora Serverless 可以将容量减少到该容量单元。

  • Maximum Aurora capacity unit (最大 Aurora 容量单元) – Aurora Serverless 可以将容量增加到该容量单元。

  • 超时操作 – 当容量修改操作因找不到扩展点而超时时要执行的操作。Aurora Serverless v1如果设置了 Force scaling the capacity to the specified values... (强制将容量扩展至指定值…) 选项,数据库集群就可以强制数据库集群使用新的容量设置。或者,如果您不选择该选项,它将可以回滚容量更改以取消它。有关更多信息,请参阅“容量更改超时操作”。

  • 不活动后暂停 – 从无数据库流量到缩减到零处理容量之间的时间长度。当数据库流量恢复后,Aurora 将自动恢复处理容量并进行扩展以处理流量。

注意

数据库集群快照的版本必须与 Aurora Serverless v1 兼容。有关所支持版本的列表,请参阅 Aurora Serverless v1

要将快照还原到与 MySQL 5.7 兼容的 Aurora Serverless v1 集群,请包括以下附加参数:

  • --engine aurora-mysql

  • --engine-version 5.7

--engine--engine-version 参数允许您从与 MySQL 5.6 兼容的 Aurora 或 Aurora Serverless v1 快照,创建与 MySQL 5.7 兼容的 Aurora Serverless v1 集群。以下示例将快照从名为 mydbclustersnapshot 的与 MySQL 5.6 兼容的集群,还原到名为 mynewdbcluster 的与 MySQL 5.7 兼容的 Aurora Serverless v1 集群。

对于 Linux、macOS 或 Unix:

aws rds restore-db-cluster-from-snapshot \ --db-cluster-identifier mynewdbcluster \ --snapshot-identifier mydbclustersnapshot \ --engine-mode serverless \ --engine aurora-mysql \ --engine-version 5.7

对于 Windows:

aws rds restore-db-cluster-from-snapshot ^ --db-instance-identifier mynewdbcluster ^ --db-snapshot-identifier mydbclustersnapshot ^ --engine aurora-mysql ^ --engine-version 5.7

您可以选择指定 --scaling-configuration 选项来配置最小容量、最大容量以及无连接时的自动暂停。有效的容量值包括:

  • Aurora MySQL:1248163264128256

  • Aurora PostgreSQL:248163264192384

在以下示例中,您将从之前创建的名为 mydbclustersnapshot 的数据库集群,还原到名为 mynewdbcluster 的新数据库集群。您可以设置 --scaling-configuration,以便新 Aurora Serverless v1 数据库集群可以根据需要,从 8 个 ACU 扩展到 64 个 ACU(Aurora 容量单元),以处理工作负载。处理完成且没有支持的连接 1000 秒后,集群将关闭,直到连接请求提示它重新启动。

对于 Linux、macOS 或 Unix:

aws rds restore-db-cluster-from-snapshot \ --db-cluster-identifier mynewdbcluster \ --snapshot-identifier mydbclustersnapshot \ --engine-mode serverless --scaling-configuration MinCapacity=8,MaxCapacity=64,TimeoutAction='ForceApplyCapacityChange',SecondsUntilAutoPause=1000,AutoPause=true

对于 Windows:

aws rds restore-db-cluster-from-snapshot ^ --db-instance-identifier mynewdbcluster ^ --db-snapshot-identifier mydbclustersnapshot ^ --engine-mode serverless --scaling-configuration MinCapacity=8,MaxCapacity=64,TimeoutAction='ForceApplyCapacityChange',SecondsUntilAutoPause=1000,AutoPause=true

要在使用 RDS API 从数据库集群中还原时配置 Aurora Serverless v1 数据库集群,请运行 RestoreDBClusterFromSnapshot 操作并为 serverless 参数指定 EngineMode

您可以选择指定 ScalingConfiguration 参数来配置最小容量、最大容量以及无连接时的自动暂停。有效的容量值包括:

  • Aurora MySQL:1248163264128256

  • Aurora PostgreSQL:248163264192384