Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes how to enable or disable high availability (HA) on your Azure Database for PostgreSQL flexible server instance by using the Azure portal or the Azure CLI. The information applies whether you're using instances in the same zone or using a zone-redundant deployment model.
The high-availability feature deploys physically separate primary and standby replicas. You can provision the replicas within the same availability zone or in different zones, depending on the deployment model that you choose. For more information, see the article about high-availability concepts. You can enable high availability during or after the creation of your Azure Database for PostgreSQL flexible server instance.
Important
In April 2024, Microsoft updated the billing model for the v5 compute tier with HA-enabled servers. This change correctly reflects the charges by accounting for both the primary and standby servers. Before this change, you were incorrectly charged for the primary server only. If you use the v5 tier with HA-enabled servers, you now see billing quantities multiplied by 2. This update doesn't affect the v4 and v3 tiers.
Enable high availability for existing servers
You can enable high availability on an existing Azure Database for PostgreSQL flexible server instance at any time. When you enable high availability, the service creates a standby replica that mirrors your primary server. Depending on regional capacity and your configuration choices, the standby can be deployed in a different availability zone for maximum protection or in the same zone as the primary.
In the Azure portal, select your Azure Database for PostgreSQL flexible server instance.
On the left menu, in the Settings section, select High availability.
The Zonal Resiliency option controls whether your server is protected across availability zones. You have two choices:
- Enabled – When you select this option, Azure tries to create the standby server in a different availability zone than the primary. This option gives you the best protection against zone-level failures.
- Disabled – High availability isn't configured.
If you enable zonal resiliency but your region lacks capacity for a zone-redundant setup, an extra checkbox appears under the Enabled option. Selecting this checkbox allows the standby server to be created in the same zone as the primary server. When zonal capacity becomes available, Azure notifies you. At that point, you can use either PITR or read replicas to migrate workloads to a zone-redundant HA configuration for maximum resiliency. For more information, see the Limitations and Considerations section.
If you didn't enable Zonal Resiliency, select the Enabled option.
When you select the Enabled option, the Zone redundant option is applied by default for regions that support availability zones. This configuration protects against zonal failures.
If the region doesn't have zonal capacity, to make sure that high availability (HA) gets enabled in your preferred region, select the checkbox under the enabled option to allow creating HA with Same-Zone mode of the region. It automatically migrates your workloads to Zone-Redundant HA once zonal capacity becomes available:
When you're done configuring the settings, select Save to apply the changes.
A dialog shows the cost increase associated with the deployment of the standby server. If you decide to proceed, select Enable high availability.
A deployment starts. When it finishes, a notification shows that you successfully enabled high availability.
Disable high availability
You can disable high availability on your Azure Database for PostgreSQL flexible server instance when you no longer need the protection of a standby replica. Disabling high availability removes the standby server and reduces costs, but your server is no longer protected against zone or server failures.
In the Azure portal, select your Azure Database for PostgreSQL flexible server instance.
On the left menu, in the Settings section, select High availability.
If high availability is enabled, the Enabled radio button for Zonal Resiliency is already selected. Also, High availability mode is set to the configured mode, and the High availability status value is typically Healthy.
Select the Disabled radio button to disable high availability.
Select Save to apply the changes.
A dialog shows the cost reduction associated with the removal of the standby server. If you decide to proceed, select Disable high availability.
A deployment starts. When it finishes, a notification shows that you successfully disabled high availability.
Enable high availability during server provisioning
You can configure high availability when you first create your Azure Database for PostgreSQL flexible server instance. By enabling high availability during provisioning, you deploy a standby replica alongside your primary server, so you get immediate protection against zone or server failures.
In the Azure portal, during provisioning of a new Azure Database for PostgreSQL flexible server instance, go to the Business Critical (High availability) section. Select the Enabled option in the Zonal Resiliency section.
- By default, the server tries to create the standby server in a different availability zone with Zone-Redundant HA mode for maximum zonal resiliency.
If zonal capacity isn't available, select the Allow standby in same zone if zonal resiliency fails checkbox as a fallback. If you don't select this option, you can't proceed to the next step in the create workflow. This check ensures high availability remains enabled. When zonal capacity becomes available, Azure notifies you. You can then use PITR or read replicas to migrate workloads to a zone-redundant HA configuration for maximum resiliency.
After you select the checkbox, proceed to the Authentication section in the create workflow.
Select a specific zone for the primary server by setting Availability zone to any value other than No preference.
Initiate a forced failover
Follow these steps to force a failover of your primary server to the standby server in Azure Database for PostgreSQL.
When you initiate a forced failover, the primary server immediately goes down and triggers a failover to the standby server. Initiating a forced failover is useful when you want to test how a failover caused by an unplanned outage would affect your workload.
Important
Don't perform immediate, back-to-back failovers. Wait for at least 15 to 20 minutes between failovers. This wait time allows the new standby server to be fully established.
The overall end-to-end operation time, as reported on the portal, might be longer than the actual downtime that the application experiences. You should measure the downtime from the application's perspective.
In the Azure portal, select your Azure Database for PostgreSQL flexible server instance that has high availability enabled.
On the left menu, in the Settings section, select High availability.
If the high-availability mode is set to Zone redundant, note the values assigned to Primary availability zone and Standby availability zone. Reverse these values after the failover operation finishes.
Select Forced failover to start the manual failover procedure. A dialog informs you of the expected downtime until the failover finishes. If you decide to proceed, select Initiate forced failover.
A notification appears and mentions that a failover is in progress.
After the failover to the standby server completes, a notification informs you of the completion.
If the high-availability mode is configured as Zone redundant, confirm that the values of Primary availability zone and Standby availability zone are now reversed.
Initiate a planned failover
Follow these steps to perform a planned failover from your primary server to the standby server in Azure Database for PostgreSQL. Initiating this operation prepares the standby server and then performs the failover.
This failover operation provides the least downtime, because it performs a graceful failover to the standby server. It's useful for situations like bringing the primary server back to your preferred availability zone after an unexpected failover.
Important
Don't perform immediate, back-to-back failovers. Wait for at least 15 to 20 minutes between failovers. This wait time allows the new standby server to be fully established.
Perform planned failovers during low-activity periods.
The overall end-to-end operation time, as reported on the portal, might be longer than the actual downtime that the application experiences. You should measure the downtime from the application's perspective.
In the Azure portal, select your Azure Database for PostgreSQL flexible server instance that has high availability enabled.
On the left menu, in the Settings section, select High availability.
If the high-availability mode is set to Zone redundant, note the values assigned to Primary availability zone and Standby availability zone. Reverse these values after the failover operation finishes.
Select Planned failover to start the manual failover procedure. A dialog informs you of the expected downtime until the failover finishes. If you decide to proceed, select Initiate planned failover.
A notification appears and mentions that failover is in progress.
After the failover to the standby server completes, a notification informs you of the completion.
If the high-availability mode is configured as Zone redundant, confirm that the values of Primary availability zone and Standby availability zone are now reversed.
Limitations and considerations
Enabling or disabling high availability on an Azure Database for PostgreSQL flexible server instance doesn't change other settings, including networking configuration, firewall settings, server parameters, or backup retention. Enabling or disabling high availability is an online operation. It doesn't affect your application connectivity and operations.
Azure Database for PostgreSQL supports high availability with both replicas deployed in the same zone. This configuration is available in all supported regions. However, high availability with zone redundancy is available only in certain regions.
The Burstable tier doesn't support high availability. Only the General purpose and Memory optimized tiers support high availability.
If you deploy a server in a region that consists of a single availability zone, you can enable high availability in the same-zone mode only. If the region is enhanced in the future with multiple availability zones, you can deploy new Azure Database for PostgreSQL flexible server instances with high availability configured as same zone or zone redundant.
However, for any instances that you deployed in the region when the region consisted of a single availability zone, you can't directly enable high availability in zone-redundant mode. As a workaround, you can use the restore option or read replica option:
Restore option
- Restore an existing instance on a new server by using the latest restore point.
- After you create the new server, enable high availability with zone redundancy.
- After data verification, you can optionally delete the old server.
- Make sure that the connection strings of your clients are modified to point to your newly restored server.
Read replica option
- Create a read replica in the same region as your primary server.
- Promote the read replica to become the new primary server.
- To preserve the original name, either use virtual endpoints or drop the old primary, then create and promote a new read replica.
- For portal users, enable Zonal Resiliency. For developer tools, set High Availability with the Zone-Redundant option.