|
| 1 | += PostgreSQL Major Version Upgrade |
| 2 | + |
| 3 | +== Overview |
| 4 | +VSHNPostgreSQL supports major version upgrades up to the latest available version. |
| 5 | + |
| 6 | +[WARNING] |
| 7 | +==== |
| 8 | +Carefully follow the steps below to avoid prolonged downtime or data loss. |
| 9 | +==== |
| 10 | + |
| 11 | +== Preparing for the Upgrade |
| 12 | +Major version upgrades carry risks, so before proceeding, ensure the following: |
| 13 | + |
| 14 | +. **Check Disk Space**: Although the upgrade process uses hard links for data migration, we recommend having at least double the free storage as a precaution. Check xref:vshn-managed/postgresql/major-upgrade.adoc#_available_disk_space[Available Disk Space]. |
| 15 | +. **Verify Extensions**: If your instance uses extensions, confirm they are available and compatible with the target PostgreSQL version. Check the https://stackgres.io/extensions/[StackGres Extensions] repository for compatibility. |
| 16 | +. **Review Configuration Changes**: If your current PostgreSQL configuration cannot be used with the new version, contact us before proceeding. |
| 17 | +. **Test the Upgrade**: Perform the upgrade in a VSHNPostgreSQL test environment to validate the process before applying it to VSHNPostgreSQL production. Check the xref:vshn-managed/postgresql/major-upgrade.adoc#_example_updating_an_existing_postgresql_instance[example]. |
| 18 | +. **No Upgrade Progress**: The upgrade process cannot be followed at this time. |
| 19 | + |
| 20 | +== Limitations |
| 21 | +The following configurations are not supported for major version upgrades: |
| 22 | + |
| 23 | +* **HA Instances**: High availability (HA) instances must be scaled down to **1 replica** before proceeding. |
| 24 | +* **Unsupported Extensions**: Instances using `postgis` or `timescaledb` extensions cannot be upgraded at this time. |
| 25 | +* **One Version at a Time**: Upgrades must be performed sequentially, moving only **one major version forward per upgrade cycle**. |
| 26 | + |
| 27 | +== Upgrade Procedure |
| 28 | + |
| 29 | +=== Example: Updating an Existing PostgreSQL Instance |
| 30 | +To upgrade a PostgreSQL instance from version **15** to **16**, modify your Kubernetes resource definition: |
| 31 | + |
| 32 | +[source,yaml] |
| 33 | +---- |
| 34 | +apiVersion: vshn.appcat.vshn.io/v1 |
| 35 | +kind: VSHNPostgreSQL |
| 36 | +metadata: |
| 37 | + name: pgsql-app1-prod |
| 38 | + namespace: prod-app |
| 39 | +spec: |
| 40 | + parameters: |
| 41 | + service: |
| 42 | + majorVersion: "16" # Upgrade from 15 to 16 <1> |
| 43 | + writeConnectionSecretToRef: |
| 44 | + name: postgres-creds |
| 45 | +status: |
| 46 | + currentVersion: "15" # Current PostgreSQL version <2> |
| 47 | +---- |
| 48 | +<1> Specify the target major version. |
| 49 | +<2> Ensure that the current version is correctly listed before applying the upgrade. |
| 50 | + |
| 51 | +NOTE: The process is finished once `currentVersion` equals the `majorVersion` value. |
| 52 | + |
| 53 | +== Available Disk Space |
| 54 | +To check the available disk space for a VSHNPostgreSQL instance, follow these steps: |
| 55 | + |
| 56 | +. _Check the Total Disk Space Allocated_ |
| 57 | ++ |
| 58 | +Run the following command to retrieve the total disk space assigned to your VSHNPostgreSQL instance: |
| 59 | ++ |
| 60 | +[source,bash] |
| 61 | +---- |
| 62 | +kubectl -n <namespace> get VSHNPostgreSQL <name-of-instance> -o=jsonpath='{.spec.parameters.size}' |
| 63 | +---- |
| 64 | +NOTE: If the disk storage size is not available, refer to the xref:vshn-managed/postgresql/plans.adoc[plan documentation] for details. |
| 65 | + |
| 66 | +. _Check Database Sizes from Within the PostgreSQL Instance_ |
| 67 | ++ |
| 68 | +Connect to your VSHNPostgreSQL instance using admin credentials and list the sizes of all databases: |
| 69 | ++ |
| 70 | +[source,bash] |
| 71 | +---- |
| 72 | +\l+ |
| 73 | +---- |
0 commit comments