Upgrade PostgreSQL to v13
CentOS 7 and RHEL 7 Guide to upgrade from PostgreSQL 9.5 to PostgreSQL 13
Last updated
CentOS 7 and RHEL 7 Guide to upgrade from PostgreSQL 9.5 to PostgreSQL 13
Last updated
Older installations of Polarity Server will likely be running version 9.5 of PostgreSQL. As v9.5 has reached end of life, we recommend upgrading to v4.x supports Postgres database servers above v9.5. As PostgreSQL v9.5 has reached end of life, we recommend upgrading to PostgreSQL 13 which is the default install on newer releases of Polarity Server.
This guide will step you through updating an existing PostgreSQL 9.5 database server located on the Polarity Server to the latest version of PostgreSQL 13.
Ensure you have taken a full backup of the Polarity Server database before you begin.
Install the latest Polarity Server v4.x RPMs which support PostgreSQL 9.5+
Ensure you are running either CentOS 7 or RHEL 7
Stop the Polarity Server and PostgreSQL 9.5 services:
Install the latest PostgreSQL v13 packages. Note, this assumes you have already installed the PGDG repo that downloads and installs PostgreSQL yum packages directly from . If you have not, or need to update it please run:
After the PostgreSQL repo is updated you can install the PostgreSQL 13:
As the postgres
user, initialize the PostgreSQL 13 server.
Next, check to make sure the upgrade is compatible.
If the output from above shows *Clusters are compatible*
then you can proceed to the next step which is to run the upgrade:
You may see a message saying you must update your extensions. The message will look like this:
Your installation contains extensions that should be updated with the ALTER EXTENSION command. The file update_extensions.sql when executed by psql by the database superuser will update these extensions.
After starting the PostgreSQL 13 database we will update the extensions.
Start the PostgreSQL 13 database service, restart the Polarity Server service, and disable and the PostgreSQL 9.5 database server:
If you need to update your extensions (see message from above) then run the following command now that the PostgreSQL 13 database is running:
Next you will need to re-create the user stats materialized view:
Once the database is successfully updated, remove the PostgreSQL 9.5 packages:
Finally, confirm the Polarity Server and PostgreSQL 13 database server are running:
You should see the new postgresql-13
service running and active.