无法将Aurora-Postgresql从9.6.9升级到10.7

时间:2019-06-03 10:02:45

标签: postgresql amazon-web-services terraform aws-aurora

我正在db.r4.large的单个实例中运行具有aurora-postgresql引擎9.6.9的AWS Aurora PostgreSQL集群。 现在,我想将Aurora Postgresql升级到引擎10.7。

https://docs.amazonaws.cn/en_us/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Upgrading.html

AWS文档建议在修改数据库集群时,应完成升级技巧。但是,下拉列表中没有与10.x兼容的PostgreSQL。

Terraform:将引擎版本从9.6.9更改为10.7时,只会从集群中删除当前的9.6.9数据库实例,而不会创建新的10.7数据库实例。

resource "aws_rds_cluster" "test" {
...
  engine            = "aurora-postgresql"
  engine_version    = "10.7" # old 9.6.9
...

}
resource "aws_rds_cluster_instance" "test_cluster_instances" {
  count = 1
  cluster_identifier           = "${aws_rds_cluster.test.id}"
  instance_class               = "db.r4.large"
  engine                       = "aurora-postgresql"
  engine_version               = "10.7" # old 9.6.9
...
}

地形方案:

  ~ update in-place  
-/+ destroy and then create replacement  

Terraform will perform the following actions:  

  ~ aws_rds_cluster.test  
      engine_version:                  "9.6.9" => "10.7"  

-/+ aws_rds_cluster_instance.test_cluster_instances (new resource required)  
      id:                              "test-0" => <computed> (forces new resource)  
      apply_immediately:               "true" => "true"  
      arn:                             "arn:aws:rds:us-east-1:xxxxxx:db:test-0" => <computed>  
      auto_minor_version_upgrade:      "false" => "false"  
      availability_zone:               "us-east-1a" => <computed>  
      cluster_identifier:              "test" => "test"  
      copy_tags_to_snapshot:           "true" => "true"  
      db_parameter_group_name:         "default.aurora-postgresql9.6" <computed>  
      db_subnet_group_name:            "test_db" => "test_db"  
      dbi_resource_id:                 "db-QDIHAS6J2MLMVKHVUENDTFWQJE" => <computed>   
      endpoint:                        "xxxxx.us-east-1.rds.amazonaws.com" => <computed>  
      engine:                          "aurora-postgresql" => "aurora-postgresql"  
      engine_version:                  "9.6.9" => "10.7" (forces new resource)  
      identifier:                      "test-0" => "test-0"  
      identifier_prefix:               "" => <computed>  
      instance_class:                  "db.r4.large" => "db.r4.large"  
      kms_key_id:                      "" => <computed>  
      monitoring_interval:             "0" => "0"  
      monitoring_role_arn:             "" => <computed>  
      performance_insights_enabled:    "false" => "false"  
      performance_insights_kms_key_id: "" => <computed>  
      port:                            "5432" => <computed>  
      preferred_backup_window:         "03:00-04:00" => <computed>  
      preferred_maintenance_window:    "sun:03:00-sun:04:00" => "sun:03:00-sun:04:00"  
      promotion_tier:                  "0" => "0"  
      publicly_accessible:             "true" => "true"  
      storage_encrypted:               "false" => <computed>  
      tags.%:                          "1" => "1"  
      tags.instance:                   "test-0" => "test-0"  
      writer:                          "true" => <computed>  


Plan: 1 to add, 1 to change, 1 to destroy.  

在运行Terraform时应用出现以下错误:

aws_rds_cluster.test: Modifying... (ID: test)
  engine_version: "9.6.9" => "10.7"
aws_rds_cluster_instance.test_cluster_instances: Still destroying... (ID: test-0, 10s elapsed)
aws_rds_cluster_instance.test_cluster_instances: Still destroying... (ID: test-0, 3m40s elapsed)
aws_rds_cluster_instance.test_cluster_instances: Still destroying... (ID: test-0, 3m50s elapsed)
...
...
aws_rds_cluster_instance.test_cluster_instances: Destruction complete after 3m54s


Error: Error applying plan:

1 error(s) occurred:


* aws_rds_cluster.test: 1 error(s) occurred:

* aws_rds_cluster.test: Failed to modify RDS Cluster (test): InvalidParameterCombination: Cannot upgrade aurora-postgresql from 9.6.9 to 10.7
    status code: 400, request id: c24c4c06-3d98-4ca3-ae95-bf3fd4150959

2 个答案:

答案 0 :(得分:0)

AWS文档不够清晰,但目前无法在Aurora上进行主要版本升级,例如您可以从9.6.9升级到9.6.12,但是如果不转储所有数据,创建新的10.7实例并将其还原到那里,则无法从9.6.9升级到10.7。

亚马逊声称他们正在努力进行升级,但是他们拒绝透露何时发布,可能会在今年的Re:Invent中宣布,明年甚至更晚。

这很可悲,因为在我们谈论9.6.9时,PostgreSQL 12.0才刚刚发布。

坦率地说,我不会将RDS用于任何重要的事情,它始终落后于功能(现在已落后3个主要版本),您只能使用Amazon认可的扩展,故障转移和流备份的解决方案可在并且是开源的。使用RDS / Aurora的唯一原因是它的管理,但是在操作环境中,PG(与mysql不同)非常可靠,我不记得它有任何问题。可能需要一些调优设置,但是RDS / Aurora也不会让您摆脱设置。

答案 1 :(得分:0)

截至2019年10月17日(根据您的申请要求,Derek suggestsother ways to do

  

注意

     

Aurora PostgreSQL当前不支持就地主要版本升级。要将数据库从一个主要版本迁移到另一个主要版本,可以使用转储和加载工具,例如PostgreSQL实用程序pg_dumppg_restore

来源(由@krtsh链接):https://docs.amazonaws.cn/en_us/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Upgrading.html