This topic describes the Logical Replication Slot Failover feature of ApsaraDB RDS for PostgreSQL. If the primary RDS instance of your database system fails, this feature can synchronize all logical replication slots to the secondary RDS instance.
Prerequisites
The primary RDS instance runs the following database engine versions.
Major engine version | Minor engine version |
---|---|
PostgreSQL 10 | 20201230 and later versions |
PostgreSQL 11 | 20200421 and later versions |
PostgreSQL 12 | 20201230 and later versions |
PostgreSQL 13 | 20201230 and later versions |
PostgreSQL 14 | 20211130 and later versions |
PostgreSQL 15 | 20221030 and later versions |
Note For more information about how to view and update the minor engine version, see Update the minor engine version of an ApsaraDB RDS for PostgreSQL instance.
Background information
The logical replication slots that are created in the primary RDS instance are not synchronized to the secondary RDS instance in compliance with the streaming replication protocol. In the event of a primary/secondary switchover, the logical replication slots are lost, and consequently the logical subscriptions are interrupted. The Logical Replication Slot Failover feature can synchronize all logical replication slots from the primary RDS instance to the secondary RDS instance.
Note
- The Logical Replication Slot Failover feature is enabled for ApsaraDB RDS for PostgreSQL instances by default. Failovers are supported for logical replication slots. However, failovers are not supported for physical replication slots.
- For more information, see Logical Decoding Concepts.
View the status of the Logical Replication Slot Failover feature
You can execute the following SQL statement to check whether the Logical Replication Slot Failover feature is enabled:
SHOW rds_failover_slot_mode;
The following result is returned:
rds_failover_slot_mode
------------------------
async
(One row of result)
One of the following results can be returned:
- async: The Logical Replication Slot Failover feature is enabled.
- off: The Logical Replication Slot Failover feature is supported but is not enabled.
- ERROR: unrecognized configuration parameter "rds_failover_slot_mode": The Logical Replication Slot Failover feature is not supported. Make sure that the major engine version and minor engine version that you use are included in the preceding table. If you are not using the major engine version and minor engine version that are supported by the Logical Replication Slot Failover feature, upgrade your RDS instance. For more information, see Upgrade the major engine version of an ApsaraDB RDS for PostgreSQL instance and Update the minor engine version of an ApsaraDB RDS for PostgreSQL instance.