Upgrade PrivX Database to Supported Version

PostgreSQL 9.x and 10.x have reached end of life since 2021 and 2022 respectively. If your PrivX runs on an outdated version, you should upgrade your PostgreSQL database to a supported version.

The high-level steps involve taking full backup, installing a new version of PostgreSQL database, restoring database data and configuration to the new database. This upgrade requires a service maintenance interruption.

The following are detailed steps for upgrading from PostgreSQL 10.x to 11.x. Please consult your database administrator for environment specific scenarios.

See End-of-support and upgrading PostgreSQL

Steps

  1. Stop PrivX

  2. Login to the host where the current database is installed. Check the location of the database, the default location is /var/lib/pgsql/pgsql-10/data

  3. Take full backup of the database.

  4. su - postgres -c "pg_dumpall -f privx.dump"

    Double check the database backup is created, default location at /var/lib/pgsql

  5. Stop postgreSQL database

sudo systemctl stop postgresql
  1. Install and initialize PostgreSQL
  2. Restore data from the backup use either A or B, for details of pgupgrade https://www.postgresql.org/docs/current/pgupgrade.html (A is not recommended, if the command of old postgres is not under /usr/pgsql-10/bin or /usr/pgsql-9/bin instead under/usr/bin )

Option 1: (recommended)

sudo su - postgres -c "psql < privx.dump"

Option 2:

sudo systemctl stop postgresql
su - postgres -c "/usr/pgsql-11/bin/pg_upgrade --old-datadir=/var/lib/pgsql/10/data --new-datadir=/var/lib/pgsql/11/data --old-bindir=/usr/pgsql-10/bin --new-bindir=/usr/pgsql-11/bin"
  1. Restore database configuration
sudo cp /var/lib/pgsql/10/data/pg_hba.conf /var/lib/pgsql/11/data/pg_hba.conf

Compare /var/lib/pgsql/11/data/postgresql.conf with /var/lib/pgsql/10/data/postgresql.conf. Copy the old configuration file or manually merge the changes to the new configuration files. Note the following settings required by PrivX.

max_connections = 1000
ssl = on
password_encryption = scram-sha-256

Then

sudo restorecon /var/lib/pgsql/11/data/server.*
sudo chown postgres /var/lib/pgsql/11/data/server.*
  1. Restart PostgreSQL
sudo systemctl restart postgresql
  1. Restart PrivX

On PrivX node, check the psql version

psql --version

If the psql is also an older version, you should also upgrade it, although older versions of psql will still work with the new PostgreSQL server

Start PrivX

sudo systemctl start privx

Was this page helpful?

On this page