PostgreSQL Upgrade Guide v16.8
Upgrading PostgreSQL is crucial to ensure your database system benefits from the latest features, performance improvements, and security enhancements. This document provides a step-by-step guide to upgrading PostgreSQL efficiently and safely from version 11 to 16.8.
This document applies to ServiceOps v8.6.0 and above.
Supported Operating Systems
- Ubuntu 22
- Ubuntu 24
- Red Hat 9.2
- Red Hat 9.4
For clients using Ubuntu 18 or Ubuntu 20, upgrading the OS to Ubuntu 22 is necessary before proceeding with the below steps.
Procedure
To upgrade the PostgreSQL version, follow the below steps:
Pre-Upgrade Preparations
Before initiating the upgrade process, it is essential to take necessary backups and precautions to prevent data loss.
- Take a Database Backup:
- Take a VM Snapshot: If the server runs on a virtual machine, create a snapshot before upgrading. This will help restore the system in case of any unexpected failures.
Stop All Services
Before upgrading the ServiceOps application, stop all the running services to avoid conflicts during the installation.
Open the terminal and stop all the services using the following commands:
sudo systemctl stop ft-analytics-server.service ft-main-server.service ft-chat-server.service ft-ai-server.service ft-file-server.service ft-plugin-server.service meshcentral.service
Verify the status of the services using the below commands:
sudo systemctl status ft-analytics-server.service ft-main-server.service ft-chat-server.service ft-ai-server.service ft-file-server.service ft-plugin-server.service meshcentral.service
If any service is still running, repeat the stop command.
Prepare for PostgreSQL Upgrade
After ensuring that all services are stopped, follow these steps to upgrade the PostgreSQL:
Download the MotadataPGDBUpgrade file.
Login to the terminal server.
Switch to the root user
Provide the necessary execution permissions to the PostgreSQL upgrade installer using the below command:
chmod 777 MotadataPGDatabaseUpgrade
Run the PostgreSQL upgrade installer using the below command:
./ MotadataPGDatabaseUpgrade
Ensure that the installer is executed with the root user only.
- Enter Y for Yes when the “Do You Want To Install PostgreSQL 16.8 Database ?” prompt appears.
Verify PostgreSQL Upgrade
Once the PostgreSQL upgrade is installed, check the PostgreSQL version to confirm the upgrade was successful:
Switch to the Postgres user using the below command:
sudo su
su postgresOpen the PostgreSQL console:
psql
Check the installed version:
select version();
Ensure that the version displayed matches the expected upgraded version.
Restart Services
Once the PostgreSQL version is upgraded successfully, restart all the previously stopped services:
sudo systemctl start ft-analytics-server.service
sudo systemctl start ft-main-server.service
sudo systemctl start ft-chat-server.service
sudo systemctl start ft-ai-server.service
sudo systemctl start ft-file-server.service
sudo systemctl start ft-plugin-server.service
sudo systemctl start meshcentral.service
Monitor Logs & Services
Observe the logs and services to ensure everything is running smoothly. Pay special attention to the following key services:
- Main Server
- AI Server
- Analytics Server
- Plugin Server
- Meshcentral Server