This topic describes how to upgrade the major version of an ApsaraDB RDS for PostgreSQL instance using the in-place upgrade method.
Prerequisites
The instance runs RDS for PostgreSQL 16 or an earlier version.
The storage type of the instance is cloud disk.
NoteIf the instance uses high-performance local disks, you can only upgrade the major version using the blue-green deployment method.
The billing method of the instance is pay-as-you-go or subscription.
NoteIf the instance is a serverless instance, you can only upgrade the major version using the blue-green deployment method.
The instance is not a read-only instance or a dedicated cluster instance.
Babelfish is not enabled for the instance. The minor engine version number does not end with
babelfish.
Background information
The in-place upgrade method uses pg_upgrade to upgrade the source instance to the destination version. All metadata, including the configuration and billing information of the source instance, is retained.
The ApsaraDB RDS console also supports major version upgrades using the zero-downtime method and the blue-green deployment method. For a comparison of the upgrade methods, see Introduction to major version upgrade methods.
Upgrade fee
Free.
Precautions
Service impact: During the switchover, the instance is set to read-only, and a transient connection that lasts for several minutes may occur. We recommend that you perform the upgrade during off-peak hours.
The duration of the read-only state depends on the number of database objects. The more database objects an instance has, the longer the read-only state lasts. If the number of database objects is in the millions, the read-only state may last for tens of minutes or even hours. You can run the
SELECT count(1) FROM pg_class;command to view the number of database objects.Instance type: If the instance type does not meet the recommended specifications during the upgrade, the system automatically attempts to upgrade the instance using the recommended instance type. This action places the instance in a read-only state for several minutes and causes an additional transient connection that lasts for a few seconds. Before you upgrade the major version, you must resolve the alerts about the instance type in the major version upgrade check report.
Replication slots:
If the source instance is a publisher that has replication slots, the replication slots are lost after the upgrade.
If the source instance is a subscriber that has replication slots, a replication slot preemption may occur during the upgrade and cause data inconsistency. For more information about how to resolve this issue, see How do I prevent data inconsistency caused by replication slot preemption during an upgrade?
Parameter changes:
If the source instance uses parameters that are not supported by the destination version, these parameters are automatically deleted after the upgrade.
If the value of a parameter on the source instance is outside the valid value range of the corresponding parameter in the destination version, the parameter is reset to its default value from the parameter template of the destination version.
During the upgrade, the system temporarily changes the value of
statement_timeoutto 0 and restores the initial value after the upgrade is complete.
DTS tasks: If the instance to be upgraded is used as a source or destination instance for Data Transmission Service (DTS), you must rebuild the DTS task after the upgrade.
Plugin compatibility issues: When you upgrade the major version, the system automatically updates the instance to the latest minor engine version. This may cause plugin compatibility issues.
Instance backup: Before and after the upgrade, a full backup of the instance is created. This lets you clone and restore the instance later.
Step 1: Perform a pre-upgrade check
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
(Optional) If read-only instances are created for the instance to be upgraded, change the endpoint of the read-only instances in your application to the endpoint of the primary instance, and then delete the read-only instances.
NoteTo ensure service stability, we recommend that you change the application endpoint during off-peak hours.
In the navigation pane on the left, click Major Version Upgrade.
NoteIf Major Version Upgrade does not appear in the navigation pane on the left, check the version and configuration of your ApsaraDB RDS for PostgreSQL instance. For more information, see Prerequisites.
On the Upgrade Check tab, click Create upgrade check report.
Select the destination version, set Upgrade Mode to Local Upgrade, and then click OK.
The instance enters the Maintaining Instance state. After the pre-upgrade check is complete, the instance status changes to Running.
If the result of the upgrade check report is Success or Warning, you can proceed with the major version upgrade. If the result is Failed, click View Information, fix the failed check items based on the report, and then perform the pre-upgrade check again. For more information about common errors and their causes, see Interpret the major version upgrade check report for an ApsaraDB RDS for PostgreSQL instance.
ImportantTo ensure a successful upgrade, if the check result is Warning, we recommend that you fix the failed check items based on the report and perform the pre-upgrade check again until the result is Success.
After the upgrade check is successful, if you create a plugin on the primary instance, you must perform the check again.
Step 2: Upgrade the major version
Click the Upgrade Instance tab. Read the warnings, select the destination version, and then click Create Upgrade Task.
In the dialog box that appears, read the prompt and click OK.
In the Create Major Engine Version Upgrade Task section, set Upgrade Mode to Local Upgrade and configure the Cutover time. The switchover time is when your services are switched to the destination instance after the migration is complete.
immediately: The switchover is performed immediately after the migration is complete.
Instance operation and maintenance time: The switchover is performed within the specified maintenance window.
Click Create.
When the instance status changes to Migrating, the upgrade task has started.
The time required for the upgrade is closely related to the number of database objects in the instance. The more database objects there are, the longer the upgrade takes. During the major version upgrade, you can view the upgrade progress in the Task Hub.
ImportantYou cannot modify or delete an upgrade task after it is created.
When the source instance is in the Migrating state, you cannot perform operations and maintenance (O&M) on the instance, such as modifying parameters, restarting the instance, or releasing the instance.
View the upgrade result.
The instance is successfully upgraded when the status of both the source and destination instances is Running.
NoteAfter the upgrade is complete, on the Upgrade History tab, find the upgrade task and click View Information in the Upgrade Log column to view the read-only duration and detailed upgrade process. The read-only duration is the period between the Cutover Time and the Switchover End Time. This period does not include the time during which the instance is inaccessible because the DNS cache is not purged.
What to do next
If you deleted read-only instances before the upgrade, perform the following steps:
Create ApsaraDB RDS for PostgreSQL read-only instances on the destination instance.
In your application, change the endpoint that you previously set to the primary instance endpoint to the new read-only instance endpoint.
Upgrade result description
During the upgrade, the upgrade record on the Upgrade History tab shows one of the following Upgrade Result.
Upgrade result | Instance status | Description | Action |
Running | Migrating | The upgrade task is in progress. | None. |
Succeeded | Running | The upgrade task is successful. | None. |
Related API operations
API | Description |
Performs a pre-upgrade check for a major version upgrade of an ApsaraDB RDS for PostgreSQL instance. | |
Queries the major version upgrade check report of an ApsaraDB RDS for PostgreSQL instance. | |
Upgrades the major version of an ApsaraDB RDS for PostgreSQL instance. | |
Queries the historical tasks of major version upgrades for an ApsaraDB RDS for PostgreSQL instance. |
References
Upgrade a major version using the zero-downtime method
Upgrade a major version using the blue-green deployment mode
Interpret the major version upgrade check report for an ApsaraDB RDS for PostgreSQL instance