英文:
AWS Aurora: upgrading to serverless v2 from v1
问题
我被要求升级我们的AWS Aurora引擎版本,从11.16升级到15.2。我们正在运行与Postgres兼容的引擎。
作为升级的一部分,也建议我们从Serverless版本1升级到Serverless版本2。
从https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.upgrade.html#aurora-serverless-v2.upgrade-from-serverless-v1-procedure,看起来我需要执行以下操作:
- 将Aurora从11.16升级到13.9;
- 将Serverless v1集群转换为预配置的Aurora PostgreSQL集群;
- 修改预配置的DB集群的写入DB实例以使用Serverless v2 DB实例类;
- 对Aurora执行第二次升级,从13.9升级到15.2。
我已经阅读了AWS文档,一切都似乎都很清晰,直到我到达上面提到的步骤(3)。文档将我发送到https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2-administration.html#aurora-serverless-v2-converting-from-provisioned,但在该部分中,它实际上似乎没有解释我需要采取哪些步骤来修改写入实例。有链接到其他页面,但我变得越来越迷失。
请问是否有人可以提供如何执行上述第三步的示例?也许我正在寻找错误的信息,但在AWS文档之外,我找不到如何执行此操作的示例。
提前感谢任何帮助。
英文:
I've been tasked with upgrading our AWS Aurora engine version from 11.16 to 15.2. We're running a Postgres-compatible engine.
As part of this upgrade, it's also been suggested that we upgrade from Serverless version 1 to Serverless version 2.
From https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.upgrade.html#aurora-serverless-v2.upgrade-from-serverless-v1-procedure, it looks like I need to do the following:
- Upgrade Aurora from 11.16 to 13.9;
- Convert the Serverless v1 cluster to a provisioned Aurora PostgreSQL cluster;
- Modify the writer DB instance of the provisioned DB cluster to use the Serverless v2 DB instance class;
- Do a second upgrade of Aurora from 13.9 to 15.2.
I've read through the AWS documentation and it all seems to make sense until I get to point (3) above. The documentation sends me to https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2-administration.html#aurora-serverless-v2-converting-from-provisioned but within that section, it doesn't actually seem to explain what steps I need to take in order to modify the writer instance. There are links to other pages but I get increasingly lost.
Would anyone have an example of how to do step (3) above, please? Perhaps I'm looking for the wrong thing but I can find no examples of how to do this outside of the AWS documentation either.
Thanks in advance for any assistance.
答案1
得分: 0
我花了很多时间编写一个库,因为RDS很棘手!RDS控制台自动化操作的方式需要很长时间才能弄清楚。因为删除和恢复数据库可能需要时间,而涉及到集群时,事情的顺序变得更加复杂,请参见https://github.com/MeaningOfLights/AWSUtils/blob/main/RDSOpsForPowershell.ps1中的DeleteClusterAndInstance
方法。
这是升级Aurora集群的大致指南:
创建数据库快照
aws rds create-db-snapshot --db-cluster-identifier
使用版本13.9创建新的Aurora集群
aws rds create-db-cluster --db-cluster-identifier
等待新集群可用
aws rds wait db-cluster-available --db-cluster-identifier
从快照中恢复数据到新集群
aws rds restore-db-cluster-from-snapshot --db-cluster-identifier
使用--engine-version 13.9参数创建一个新的RDS集群:
aws rds create-db-cluster --db-cluster-identifier
然后修改专用集群的写入数据库实例
aws rds modify-db-instance --db-instance-identifier
您将需要使用AWS数据库迁移服务(DMS)或pg_dump/pg_restore等数据迁移工具来迁移数据,您可以在我的RDS库中看到一个名为function InstallPostgresTools($S3Name)
的脚本,这是一个DMS示例:
创建DMS复制实例(如果尚未创建)
aws dms create-replication-instance --replication-instance-identifier
创建DMS复制任务
aws dms create-replication-task --replication-task-identifier
启动DMS复制任务
aws dms start-replication-task --replication-task-arn
英文:
I've spent a lot of time writing a library because RDS is tricky! They way the RDS console automates things takes ages to work out. Because deleting and restoring databases can take time and when you involve clusters the order of things gets even trickier, see the DeleteClusterAndInstance
method in: https://github.com/MeaningOfLights/AWSUtils/blob/main/RDSOpsForPowershell.ps1
This is a rough guide of how to upgrade your Aurora cluster:
# Create a DB snapshot
aws rds create-db-snapshot --db-cluster-identifier <your-cluster-identifier> --db-snapshot-identifier <snapshot-identifier>
# Create a new Aurora cluster with version 13.9
aws rds create-db-cluster --db-cluster-identifier <new-cluster-identifier> --engine aurora-postgresql --engine-version 13.9 --snapshot-identifier <snapshot-identifier>
# Wait for the new cluster to be available
aws rds wait db-cluster-available --db-cluster-identifier <new-cluster-identifier>
# Restore data from the snapshot into the new cluster
aws rds restore-db-cluster-from-snapshot --db-cluster-identifier <new-cluster-identifier> --snapshot-identifier <snapshot-identifier>
Create a new RDS Cluster with the --engine-version 13.9 arg:
aws rds create-db-cluster --db-cluster-identifier <provisioned-cluster-identifier> --engine aurora-postgresql --engine-version 13.9 --engine-mode provisioned --db-instance-class <instance-class> --master-username <username> --master-user-password <password> --vpc-security-group-ids <security-group-ids> --availability-zones <availability-zones>
Then modify the writer DB instance of the provisioned cluster
aws rds modify-db-instance --db-instance-identifier <writer-instance-identifier> --db-cluster-identifier <provisioned-cluster-identifier> --db-instance-class <serverless-v2-instance-class>
You'll need to use a data migration tool like AWS Database Migration Service (DMS) or pg_dump/pg_restore to migrate the data, you'll see in my RDS Library I've got a script function InstallPostgresTools($S3Name)
, here's a DMS example:
# Create a DMS replication instance (if not already created)
aws dms create-replication-instance --replication-instance-identifier <replication-instance-identifier> --replication-instance-class <instance-class> --allocated-storage <storage-size>
# Create a DMS replication task
aws dms create-replication-task --replication-task-identifier <task-identifier> --source-endpoint-arn <source-endpoint-arn> --target-endpoint-arn <target-endpoint-arn> --migration-type full-load-and-cdc --table-mappings file://table-mappings.json
# Start the DMS replication task
aws dms start-replication-task --replication-task-arn <replication-task-arn>
答案2
得分: 0
最后,由于我们地区的限制,我们只升级到了Aurora Postgres 13.9与Serverless v2。
我们发现有效的步骤如下:
- 将Postgres集群从11.16转换为13.9(Serverless v1)
- 删除Postgres 13.9(Serverless v1)集群
- 创建一个新的Postgres 13.9预配置集群
- 向预配置集群添加3个预配置的数据库实例(1个写入实例,2个读取实例)
- 将所有三个预配置的数据库实例转换为Serverless v2
英文:
In the end, we only upgraded to Aurora Postgres 13.9 with Serverless v2 due to restrictions in our region.
The process that we found worked was as follows:
- Convert Postgres cluster from 11.16 to 13.9 (serverless v1)
- Remove the Postgres 13.9 (serverless v1) cluster
- Create a new Postgres 13.9 provisioned cluster
- Add 3 provisioned DB instances (1 writer, 2 readers) to the provisioned cluster
- Convert all three of the provisioned DB instances to serverless v2
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论