This article provides step-by-step instructions to upgrade PostgreSQL used by the meshIQ Platform Deployment Pack.
Prerequisites
Before you begin:
Ensure you have the latest PostgreSQL package from meshIQ.
Perform full backups of existing PostgreSQL data and related directories.
Stop all meshIQ services.
If PostgreSQL is hosted on a remote server, ensure the correct hostname and port are configured.
Upgrade Steps
1. Back Up the Existing PostgreSQL Directory
From the $APIN_HOME directory, run:
tar -czvf pgsql_old_backup.tar.gz pgsql
2. Stop meshIQ Services
Stop the following services:
CEP
DOMAIN
WEB
3. Back Up Individual Databases
While PostgreSQL is still running, back up each database.
Navigate to the PostgreSQL binary directory and run the following commands one by one:
cd $APIN_HOME/pgsql/bin ./pg_dump -h localhost -U postgres nastel_apwmq > nastel_apwmq.sql ./pg_dump -h localhost -U postgres nastel_permv3 > nastel_permv3.sql ./pg_dump -h localhost -U postgres scheduler > scheduler.sql
If PostgreSQL is running on a remote host, replace localhost with the appropriate hostname or IP address.
4. Stop PostgreSQL
From $APIN_HOME/sbin, run:
./stop.sh pgsql
5. Rename the Existing PostgreSQL Folder
mv pgsql pgsql_old
6. Download the Latest PostgreSQL Package
Download the latest database package from:
https://data.meshiq.com/AP6/Deployment_Pack/General/Database/
7. Extract the New PostgreSQL Package
From $APIN_HOME, run:
tar -xvzf path_to_newpgsql.tar.Z
This creates a new pgsql directory.
8. (Optional) Update Configuration for Remote PostgreSQL
If PostgreSQL is hosted on a remote server, update the following file before starting PostgreSQL:
$APIN_HOME/config/dbconfig.properties
Update the hostname, port, and credentials as required.
9. Start PostgreSQL
From $APIN_HOME/sbin, run:
./start.sh pgsql
10. Create Required Databases
From $APIN_HOME/pgsql/bin, connect to PostgreSQL:
./psql -h localhost -U postgres
Inside psql, create the databases one by one:
CREATE DATABASE nastel_apwmq; CREATE DATABASE nastel_permv3; CREATE DATABASE scheduler;
Library Dependency:
If you encounter the following error:
./psql: error while loading shared libraries: libpq.so.5: cannot open shared object file
Export the PostgreSQL library path and retry:
export LD_LIBRARY_PATH=$APIN_HOME/pgsql/lib:$LD_LIBRARY_PATH
12. Restore the Database Backups
From $APIN_HOME/pgsql/bin, run:
./psql nastel_apwmq < nastel_apwmq.sql ./psql nastel_permv3 < nastel_permv3.sql ./psql scheduler < scheduler.sql
13. Start Domain, CEP, Web Services
Log in to Manage and confirm that everything is working as expected.
Important Notes
If PostgreSQL is running on a remote server, ensure proper connectivity and file permissions.
Always validate the upgrade process in a non-production environment before applying it to production.
Coordinate with the meshIQ Support team for production upgrades.