简体   繁体   English

使用 Bicep 更改 Azure PostgreSQL 灵活的服务器配置

[英]Changing Azure PostgreSQL flexible server configuration with Bicep

Because of our app's requirements, we want to increase the PostgreSQL database property max_connections to allow for more connections.由于我们应用程序的要求,我们希望增加 PostgreSQL 数据库属性max_connections以允许更多连接。 We are using Azure Bicep for deployment.我们正在使用 Azure Bicep 进行部署。

resource dbServer 'Microsoft.DBforPostgreSQL/flexibleServers@2021-06-01' = {
  name: serverName
  location: location
  sku: {
    name: 'Standard_B1ms'
    tier: 'Burstable'
  }
  properties: {
    createMode: 'Default'
    version: '13'
    administratorLogin: administratorLogin
    administratorLoginPassword: administratorLoginPassword
    storage: {
      storageSizeGB: 32
    }
    backup: {
      backupRetentionDays: 7
      geoRedundantBackup: 'Disabled'
    }
  }

  resource allowAzureAccess 'firewallRules' = {
    name: 'AllowAccessFromAzure'
    properties: {
      startIpAddress: '0.0.0.0'
      endIpAddress: '0.0.0.0'
    }
  }
}

resource dbServerMaxConnections 'Microsoft.DBforPostgreSQL/flexibleServers/configurations@2021-06-01' = {
  parent: dbServer
  name: 'max_connections'
  properties: {
    value: '100'
    source: 'user-override'
  }
}

This deployment sometimes works but often fails in the configuration step complaining about a conflict.此部署有时有效,但在配置步骤中经常失败并抱怨冲突。

失败

Without the configuration step, deployment always succeeds.没有配置步骤,部署总是成功的。 Any idea what the problem could be?知道问题可能是什么吗?

I was able to reproduce but the error message wasn't really helpful.我能够重现,但错误消息并没有真正的帮助。

Both AllowAccessFromAzure and max_connections resources have an implicit dependency on the server creation. AllowAccessFromAzuremax_connections资源都隐式依赖于服务器创建。 Once the server is created, these resources creation/update will be triggered in parallel and will try to update the server at the same time hence the error.创建服务器后,将并行触发这些资源创建/更新,并尝试同时更新服务器,因此出现错误。

By adding an explicit dependsOn on the max_connections resource, it will force the creation/update to be done sequentially:通过在 max_connections 资源上添加显式的dependsOn ,它将强制创建/更新按顺序完成:

resource dbServer 'Microsoft.DBforPostgreSQL/flexibleServers@2021-06-01' = {
  name: serverName
  ...

  resource allowAzureAccess 'firewallRules' = {
    name: 'AllowAccessFromAzure'
    properties: {
      startIpAddress: '0.0.0.0'
      endIpAddress: '0.0.0.0'
    }
  }

  resource dbServerMaxConnections 'configurations' = {
    name: 'max_connections'
    properties: {
      value: '100'
      source: 'user-override'
    }
    dependsOn:[
      allowAzureAccess
    ]
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以拥有 azure 灵活 postgresql 服务器的只读副本和数据子集? - Is it possible to have a read replicas of azure flexible postgresql server with a subset of data? 添加 NSG 规则以在 Azure PostgreSQL 灵活服务器上启用高可用性 - Adding NSG rules to enable high availability on Azure PostgreSQL Flexible Server Azure 用于 PostgreSQL 灵活服务器部署的数据库因 databaseName 参数错误而失败 - Azure Database for PostgreSQL flexible server deployment fails with databaseName param error Azure PostgreSQL 灵活服务器 Cron 作业权限被拒绝 - Azure PostgreSQL Flexible Server Cron Job Permission Denied 无法通过应用服务中的 VNet 访问我的 Azure for PostgreSQL 灵活服务器 - Unable to access my Azure for PostgreSQL Flexible Server through VNet from App Service 用于 postgreSQL 灵活服务器和实体框架核心的 Azure 数据库错误地显示带重音的西班牙语单词 - Azure database for postgreSQL Flexible Server and Entity Framework Core shows accented spanish words incorrectly 适用于 Postgres 灵活服务器的 Azure Log Analytics - Azure Log Analytics for Postgres Flexible Server Postgresql 服务器不断更改密码 - Postgresql server keeps on changing the password 我们可以将 pg_dumpall 用于 Azure 托管的灵活服务器吗 - Can we use pg_dumpall for Azure managed flexible Server 使用Postgresql的WSO2物联网服务器的服务器配置 - Server Configuration for WSO2 IOT Server with Postgresql
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM