Major version upgrade of EDB Postgres Extended Server v16
To perform a major version upgrade, install the new version of EDB Postgres Extended Server, initialize an empty cluster and use pg_upgrade to migrate all data.
If a problem occurs during the upgrade process, you can revert to the previous version.
Overview
- Prepare your upgrade by performing a backup of the existing instance.
- Install the EDB Postgres Extended Server version you're upgrading toward.
- Create a new database server:
- Create an empty directory for the new server and ensure postgres owns it.
- Initialize a server on a different port from the source server.
- Start the database server.
- Connect to the database server and ensure it's functioning.
- Upgrade to the target server:
- Stop both the source and the new server.
- Use pg_upgrade by specifying the source and target bin and data directories.
- Start the new database server.
- Connect to the encrypted database server and ensure the data was transferred.
- Clean up and delete the source server:
- Clean up the database and its statistics.
- Remove the source EDB Postgres Extended Server cluster with the script provided by pg_upgrade.
Worked example
This worked example upgrades an EDB Postgres Extended Server 15 database to EDB Postgres Extended Server 16.
Note
You can perform major upgrades of EDB Postgres Extended Server instances in the same way you upgrade an EDB Postgres Advanced Server installation. If you need more information about the pg_upgrade utility, command line options, troubleshooting, and more, see Upgrading an installation with pg_upgrade.
Preparing your upgrade
Use pg_dumpall, pgBackRest, or Barman to create a backup of your source server.
Installing the target EDB Postgres Extended Server version
Install EDB Postgres Extended Server version 16. Only install the packages. Don't perform any other configurations.
Creating a target server
If you don't want to create a new target instance but want to reuse an existing server with the target EDB Postgres Extended Server version, skip these steps and ensure the target server is empty.
As postgres, create an empty directory for the new server:
As root, ensure the postgres user owns the directory:
As postgres, initialize the new server:
This command initializes a CONFIG directory with all configuration files for the encrypted server.
Before you start the cluster, ensure the new database runs on a different port from the source server. To alter the port, edit
postgresql.conf
by uncommenting the line with#port
and changing the port number, for example, to 5432.Start the target server:
Note
You can also start the server with the
logfile
option enabled to print errors into a logfile:/usr/lib/edb-pge/16/bin/pg_ctl -D /var/lib/edb-pge/16/upgrade_target -l logfile start
In this case, ensure the postgres user has rights to write to the log directory.
Connect to the server:
Note
If you're using two different Postgres versions, use the psql utility of the target server. Otherwise, the system will attempt to use psql from the previous instance.
Upgrading to the target server
If you have any extensions or component services running in the source cluster, stop them before starting the upgrade. See Stop all component services and servers for more information
Stop both the source and target servers:
To test for incompatibilities, run the
pg_upgrade
command in check mode.With
-b
and-B
, specify the source and target BIN directories. With-d
and-D
, specify the source and target CONFIG directories:Note
The
--check
mode performs preliminary checks without executing the command.To copy data from the source server to the target server, run the
pg_upgrade
command in normal mode:Start the target server:
Connect to the target database server:
Perform a spot check to ensure the databases, tables, schemas, and resources you had in the unencrypted server are available in the new server. For example, list all databases, explore the database objects, views, and so on.
Restart the extensions or component services you disabled in the source cluster but in the target cluster.
Cleaning up after upgrade
After you verify that pg_upgrade migrated the data successfully, and the services are running as expected, perform a cleanup.
Clean up the database and its statistics:
Remove all data files of the unencrypted server with the script generated by
pg_upgrade
:
More information
Review Upgrading an installation with pg_upgrade for more information on pg_upgrade options, troubleshooting, and other considerations.
- On this page
- Overview
- Worked example
- More information