Skip to main content
Version: 8.5.0

PostgreSQL Upgrade Guide v11 to 16

This document describes the steps to upgrade the PostgreSQL version from 11 to 16.

note

This document applies to RedHat OS v9.2 and Ubuntu v22.04.

Prerequisites

  • Ensure there is no broken package from the Ubuntu OS side. If any, please resolve it before initiating the upgrade process.
  • Stop the Main-server and Analytics-server service.
  • Stop the MeshCentral and HA Observer server services if it exists
  • Stop the slave PostgreSQL Database server service if it exists
  • Take the database backup and download it at another location
  • Take the backup of PostgreSQL Config and Data Directory
  • Ensure the PostgreSQL Server service is running
  • Check the PostgreSQL version before applying the upgrade

Procedure

Ubuntu v22.04

To upgrade the PostgreSQL in Ubuntu, follow the below steps:

  1. Stop the main-server and analytics-server service using the below commands:
    systemctl stop ft-main-server
    systemctl stop ft-analytics-server

  1. Verify the status of the services using the below commands:
    systemctl status ft-main-server
    systemctl status ft-analytics-server

  1. Verify the status of the PostgreSQL service using the below command:

    systemctl status postgresql

  1. Check the PostgreSQL server version using the below command:

    sudo -u postgres psql -c "SELECT version();"

  1. Download the MotadataPGDatabaseUpgrade file and grant the chmod permission using the below command:

    chmod 777 MotadataPGDatabaseUpgrade

  1. Execute the downloaded file using the below command:

    ./MotadataPGDatabaseUpgrade

    It will ask for confirmation to install the PostgreSQL 16 database. Type "y" and enter.

note

Depending on the PostgreSQL server's side, the upgrade process may take some time.

  1. Once the process is completed, a message "Upgrade Complete" will appear.

  1. Next, verify the PostgreSQL server version using the below command:

    sudo -u postgres psql -c "SELECT version();"

note

If any issue or error appears, inform Motadata without performing any action. You can collect the logs using the below command:

pg_lsclusters

  1. Check the PostgreSQL server service using the below command:

    systemctl status postgresql

  1. Once the PostgreSQL server is upgraded successfully, start checking the main-server and analytics-server services.
    systemctl start ft-main-server
    systemctl start ft-analytics-server

RedHat v9.2

Similar to Ubuntu 22, follow the below process:

  1. Take the PostgreSQL database backup.

  2. Back up the PostgreSQL Config and Data Directory.

  3. Download the MotadataPGDatabaseUpgrade file and grant the chmod permission using the below command:

    chmod 777 MotadataPGDatabaseUpgrade

  1. Execute the file, and a confirmation message will appear. Type y and click enter to install the PostgreSQL 16 database.

  1. The upgrade process will begin.

  1. Upon successful upgrade, check the PostgreSQL server version.

    sudo -u postgres psql -c "SELECT version();"

  1. Also, check the PostgreSQL server service status.

note

Take the backup of VM Snapshot.