Create and manage read replicas in Azure Database for PostgreSQL - Single Server from the Azure portal
APPLIES TO:
Azure Database for PostgreSQL - Single Server
Important
Azure Database for PostgreSQL - Single Server is on the retirement path. We strongly recommend that you upgrade to Azure Database for PostgreSQL - Flexible Server. For more information about migrating to Azure Database for PostgreSQL - Flexible Server, see What's happening to Azure Database for PostgreSQL Single Server?.
In this article, you learn how to create and manage read replicas in Azure Database for PostgreSQL from the Azure portal. To learn more about read replicas, see the overview.
Prerequisites
An Azure Database for PostgreSQL server to be the primary server.
Azure replication support
Read replicas and logical decoding both depend on the Postgres write ahead log (WAL) for information. These two features need different levels of logging from Postgres. Logical decoding needs a higher level of logging than read replicas.
To configure the right level of logging, use the Azure replication support parameter. Azure replication support has three setting options:
- Off - Puts the least information in the WAL. This setting is not available on most Azure Database for PostgreSQL servers.
- Replica - More verbose than Off. This is the minimum level of logging needed for read replicas to work. This setting is the default on most servers.
- Logical - More verbose than Replica. This is the minimum level of logging for logical decoding to work. Read replicas also work at this setting.
Note
When deploying read replicas for persistent heavy write-intensive primary workloads, the replication lag could continue to grow and may never be able to catch-up with the primary. This may also increase storage usage at the primary as the WAL files are not deleted until they are received at the replica.
Prepare the primary server
In the Azure portal, select an existing Azure Database for PostgreSQL server to use as a primary.
From the server's menu, select Replication. If Azure replication support is set to at least Replica, you can create read replicas.
If Azure replication support is not set to at least Replica, set it. Select Save.
Restart the server to apply the change by selecting Yes.
You will receive two Azure portal notifications once the operation is complete. There is one notification for updating the server parameter. There is another notification for the server restart that follows immediately.
Refresh the Azure portal page to update the Replication toolbar. You can now create read replicas for this server.
Create a read replica
To create a read replica, follow these steps:
Select an existing Azure Database for PostgreSQL server to use as the primary server.
On the server sidebar, under SETTINGS, select Replication.
Select Add Replica.
Enter a name for the read replica.
Select a location for the replica. The default location is the same as the primary server's.
Note
To learn more about which regions you can create a replica in, visit the read replica concepts article.
Select OK to confirm the creation of the replica.
After the read replica is created, it can be viewed from the Replication window:
Important
Review the considerations section of the Read Replica overview.
Before a primary server setting is updated to a new value, update the replica setting to an equal or greater value. This action helps the replica keep up with any changes made to the primary.
Stop replication
You can stop replication between a primary server and a read replica.
Important
After you stop replication to a primary server and a read replica, it can't be undone. The read replica becomes a standalone server that supports both reads and writes. The standalone server can't be made into a replica again.
To stop replication between a primary server and a read replica from the Azure portal, follow these steps:
In the Azure portal, select your primary Azure Database for PostgreSQL server.
On the server menu, under SETTINGS, select Replication.
Select the replica server for which to stop replication.
Select Stop replication.
Select OK to stop replication.
Delete a primary server
To delete a primary server, you use the same steps as to delete a standalone Azure Database for PostgreSQL server.
Important
When you delete a primary server, replication to all read replicas is stopped. The read replicas become standalone servers that now support both reads and writes.
To delete a server from the Azure portal, follow these steps:
In the Azure portal, select your primary Azure Database for PostgreSQL server.
Open the Overview page for the server. Select Delete.
Enter the name of the primary server to delete. Select Delete to confirm deletion of the primary server.
Delete a replica
You can delete a read replica similar to how you delete a primary server.
In the Azure portal, open the Overview page for the read replica. Select Delete.
You can also delete the read replica from the Replication window by following these steps:
In the Azure portal, select your primary Azure Database for PostgreSQL server.
On the server menu, under SETTINGS, select Replication.
Select the read replica to delete.
Select Delete replica.
Enter the name of the replica to delete. Select Delete to confirm deletion of the replica.
Monitor a replica
Two metrics are available to monitor read replicas.
Max Lag Across Replicas metric
The Max Lag Across Replicas metric shows the lag in bytes between the primary server and the most-lagging replica.
In the Azure portal, select the primary Azure Database for PostgreSQL server.
Select Metrics. In the Metrics window, select Max Lag Across Replicas.
For your Aggregation, select Max.
Replica Lag metric
The Replica Lag metric shows the time since the last replayed transaction on a replica. If there are no transactions occurring on your primary, the metric reflects this time lag.
In the Azure portal, select the Azure Database for PostgreSQL read replica.
Select Metrics. In the Metrics window, select Replica Lag.
For your Aggregation, select Max.
Next steps
- Learn more about read replicas in Azure Database for PostgreSQL.
- Learn how to create and manage read replicas in the Azure CLI and REST API.
Atsauksmes
https://aka.ms/ContentUserFeedback.
Drīzumā: 2024. gada laikā mēs pakāpeniski pārtrauksim izmantot “GitHub problēmas” kā atsauksmju par saturu mehānismu un aizstāsim to ar jaunu atsauksmju sistēmu. Papildinformāciju skatiet:Iesniegt un skatīt atsauksmes par