You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/flexible-server/concepts-logical.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,23 +37,23 @@ Logical decoding:
37
37
* Extracts changes across all tables in a database.
38
38
39
39
40
-
## Pre-requisites for logical replication and logical decoding
40
+
## Prerequisites for logical replication and logical decoding
41
41
42
42
1. Go to server parameters page on the portal.
43
43
2. Set the server parameter `wal_level` to `logical`.
44
44
3. If you want to use pglogical extension, search for the `shared_preload_libraries`, and `azure.extensions` parameters, and select `pglogical` from the drop-down box.
45
45
4. Update `max_worker_processes` parameter value to at least 16. Otherwise, you may run into issues like `WARNING: out of background worker slots`.
46
-
5. Save the changes and restart the server to apply the `wal_level` change.
46
+
5. Save the changes and restart the server to apply the changes.
47
47
6. Confirm that your PostgreSQL instance allows network traffic from your connecting resource.
48
48
7. Grant the admin user replication permissions.
49
49
```SQL
50
50
ALTER ROLE <adminname> WITH REPLICATION;
51
51
```
52
-
8. You may want to make sure the role you are using has [privileges](https://www.postgresql.org/docs/current/sql-grant.html) on the schema that you're replicating. Otherwise, you may run into errors such as `Permission denied for schema`.
52
+
8. You may want to make sure the role you're using has [privileges](https://www.postgresql.org/docs/current/sql-grant.html) on the schema that you're replicating. Otherwise, you may run into errors such as `Permission denied for schema`.
53
53
54
54
55
55
>[!NOTE]
56
-
> It is always a good practice to separate your replication user from regular admin account.
56
+
> It's always a good practice to separate your replication user from regular admin account.
57
57
58
58
## Using logical replication and logical decoding
59
59
@@ -92,7 +92,7 @@ Here's some sample code you can use to try out logical replication.
92
92
```
93
93
You can add more rows to the publisher's table and view the changes on the subscriber.
94
94
95
-
If you are not able to see the data, enable the login privilege for `azure_pg_admin` and check the table content.
95
+
If you're not able to see the data, enable the login privilege for `azure_pg_admin` and check the table content.
96
96
```SQL
97
97
ALTER ROLE azure_pg_admin login;
98
98
```
@@ -102,7 +102,7 @@ Visit the PostgreSQL documentation to understand more about [logical replication
102
102
103
103
### pglogical extension
104
104
105
-
Here is an example of configuring pglogical at the provider database server and the subscriber. Refer to [pglogical extension documentation](https://github.com/2ndQuadrant/pglogical#usage) for more details. Also make sure you have performed pre-requisite tasks listed above.
105
+
Here is an example of configuring pglogical at the provider database server and the subscriber. Refer to [pglogical extension documentation](https://github.com/2ndQuadrant/pglogical#usage) for more details. Also make sure you have performed prerequisite tasks listed above.
106
106
107
107
1. Install pglogical extension in the database in both the provider and the subscriber database servers.
108
108
```SQL
@@ -221,7 +221,7 @@ In the example below, we use the SQL interface with the wal2json plugin.
221
221
}
222
222
```
223
223
224
-
4. Drop the slot once you are done using it.
224
+
4. Drop the slot once you're done using it.
225
225
```SQL
226
226
SELECT pg_drop_replication_slot('test_slot');
227
227
```
@@ -230,17 +230,17 @@ Visit the PostgreSQL documentation to understand more about [logical decoding](h
230
230
231
231
232
232
## Monitoring
233
-
You must monitor logical decoding. Any unused replication slot must be dropped. Slots hold on to Postgres WAL logs and relevant system catalogs until changes have been read. If your subscriber or consumer fails or if it is improperly configured, the unconsumed logs will pile up and fill your storage. Also, unconsumed logs increase the risk of transaction ID wraparound. Both situations can cause the server to become unavailable. Therefore, it is critical that logical replication slots are consumed continuously. If a logical replication slot is no longer used, drop it immediately.
233
+
You must monitor logical decoding. Any unused replication slot must be dropped. Slots hold on to Postgres WAL logs and relevant system catalogs until changes have been read. If your subscriber or consumer fails or if it's improperly configured, the unconsumed logs will pile up and fill your storage. Also, unconsumed logs increase the risk of transaction ID wraparound. Both situations can cause the server to become unavailable. Therefore, it's critical that logical replication slots are consumed continuously. If a logical replication slot is no longer used, drop it immediately.
234
234
235
-
The 'active' column in the pg_replication_slots view will indicate whether there is a consumer connected to a slot.
235
+
The 'active' column in the pg_replication_slots view will indicate whether there's a consumer connected to a slot.
236
236
```SQL
237
237
SELECT*FROM pg_replication_slots;
238
238
```
239
239
[Set alerts](howto-alert-on-metrics.md) on the **Maximum Used Transaction IDs** and **Storage Used** flexible server metrics to notify you when the values increase past normal thresholds.
240
240
241
241
## Limitations
242
242
***Logical replication** limitations apply as documented [here](https://www.postgresql.org/docs/current/logical-replication-restrictions.html).
243
-
***Slots and HA failover** - Logical replication slots on the primary server are not available on the standby server in your secondary AZ. This situation applies to you if your server uses the zone-redundant high availability option. In the event of a failover to the standby server, logical replication slots will not be available on the standby.
243
+
***Slots and HA failover** - Logical replication slots on the primary server aren't available on the standby server in your secondary AZ. This situation applies to you if your server uses the zone-redundant high availability option. In the event of a failover to the standby server, logical replication slots won't be available on the standby.
244
244
245
245
>[!IMPORTANT]
246
246
> You must drop the logical replication slot in the primary server if the corresponding subscriber no longer exists. Otherwise the WAL files start to get accumulated in the primary filling up the storage. If the storage threshold exceeds certain threshold and if the logical replication slot is not in use (due to non-available subscriber), Flexible server automatically drops that unused logical replication slot. That action releases accumulated WAL files and avoids your server becoming unavailable due to storage getting filled situation.
0 commit comments