将 Amazon Aurora PostgreSQL 从 9.6 升级到 10

Upgrade Amazon Aurora PostgreSQL from 9.6 to 10

我正在尝试通过 CloudFormation 模板命令 aws cloudformation update-stack --stack-name base --template-body file://cloudformation/base.ymlAmazon Aurora PostgreSQL 从版本 9.6 升级到 10.14,但每次更新都是使用以下消息之一进行回滚:

  1. 不可修改的数据库参数:wal_consistency_checking

  2. 不可修改的数据库参数:ssl_dh_params_file

base.yml 的部分如下所示:

DatabaseCustomParameterGroupIdentifier:
  Description: ID of the database parameter group
  Value: !Ref DatabaseCustomParameterGroup
  Export:
    Name: DatabaseCustomParameterGroupIdentifier

DatabaseCustomParameterGroup:
  Type: AWS::RDS::DBParameterGroup
  Properties:
    Description: Database Custom Parameter Group
    Family: aurora-postgresql10
    Parameters:
      pg_stat_statements.track: ALL
      shared_preload_libraries: pg_stat_statements
      track_activity_query_size: 2048
      pglogical.use_spi: true
      pglogical.synchronous_commit: true
      temp_file_limit: "-1"
      ssl_dh_params_file: ""
      wal_consistency_checking: 'all'

我从这些链接中引用了这两个参数:https://www.postgresql.org/docs/10/runtime-config-developer.html and https://www.postgresql.org/docs/10/runtime-config-connection.html

[EDIT-I] 我可以在 RDS > Parameter Groups 中看到这两个参数,其 Modifiable 值为 false

此外,当我尝试删除参数组时,我收到了这条消息:

Failed to delete default.aurora-postgresql10: Default DBParameterGroup cannot be deleted: default.aurora-postgresql10 (Service: AmazonRDS; Status Code: 400; Error Code: InvalidDBParameterGroupState).

请指教我这里做错了什么!

[EDIT-I我]

如果我再次尝试删除这 2 个参数和 运行 CF 命令,我将得到:

The following parameters are not defined for the specified group: ssl_dh_params_file, wal_consistency_checking (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterValue)

[EDIT-III]

  1. 根据 AWS 文档,我无法删除默认参数组。也许这是我尝试删除此参数组时出现上述错误的原因?
  2. 如果我看到这两个参数的属性,我可以从控制台看到以下内容:
    {
      "ParameterName": "wal_consistency_checking",
      "Description": "Sets the WAL resource managers for which WAL consistency checks are done.",
      "Source": "engine-default",
      "ApplyType": "dynamic",
      "DataType": "string",
      "IsModifiable": false,
      "MinimumEngineVersion": "10.4",
      "ApplyMethod": "pending-reboot"
    },
    {
      "ParameterName": "ssl_dh_params_file",
      "Description": "Location of the SSL DH parameters file.",
      "Source": "engine-default",
      "ApplyType": "dynamic",
      "DataType": "string",
      "IsModifiable": false,
      "MinimumEngineVersion": "10.4",
      "ApplyMethod": "pending-reboot"
    }

那些发现升级困难的人,这是我所做的:

  • 更新了基本模板并为 Postgres 10 版本添加了AWS::RDS::DBParameterGroup设置
  • 之后我执行了aws cloudformation update-stack --stack-name base --template-body file://cloudformation/base.yml --capabilities CAPABILITY_IAM命令来更新基础堆栈
  • 然后我执行了:aws rds modify-db-cluster 来自控制台的命令
$ aws rds modify-db-cluster \
>     --db-cluster-identifier DB_CLUSTER_IDENTIFIER \
>     --engine-version 10.14 \
>     --db-cluster-parameter-group-name default.aurora-postgresql10 \
>     --db-instance-parameter-group-name base-dbcustomparametergroup-pg10 \
>     --allow-major-version-upgrade \
>     --apply-immediately \
>     --debug
  • 最后,我为专用 Rails 环境执行了 CF 命令:aws cloudformation update-stack --stack-name staging --template-body file://cloudformation/template.yml --capabilities CAPABILITY_IAM

您可以在更新您的基础堆栈并复制AWS名称> RDS>参数组

后获取db-instance-parameter-group-name的值