D toc |
---|
This section describes how to upgrade in-use instances of the
D s item | ||||
---|---|---|---|---|
|
D s platform |
---|
When you upgrade to a new release of the platform, the underlying databases and their structures are automatically migrated to the new format. However, the database releases are not touched.
In this example, Postgres 9.3 is upgraded to Postgres 9.6.
Pre-requisites
- The installing user must have write permissions to the directory from which the commands are executed.
- The installing user must have sudo privileges.
- Verify that you know the host and port number for each database.
Backup
Before you begin, please verify that you have a valid backup of each
D s item | ||
---|---|---|
|
Acquire Distribution and Port Information
Before you begin, you must:
- Acquire the port information for the current database. Typically, this value is
5432
.D s pssql port - Acquire the latest distribution for the database software.
For more information, see Install Databases for PostgreSQL.
Database Upgrade Process
This procedure describes the process for upgrading the PostgreSQL version in use by the
D s item | ||
---|---|---|
|
- Source version: PostgreSQL 9.3
- Upgrade version: PostgreSQL 9.6
- All current databases are co-located with the software on the
.D s node - Some downtime of the databases during the upgrade process is ok.
Before You Begin
- If you haven't already, please back up each database and all PostgreSQL configuration files. See Backup and Recovery.
- Login to the node where the databases are hosted.
Using non-default ports
The default port for these commands is port 5432
.
If you are using a non-standard port for either the pre- or post-upgrade versions of PostgreSQL, you can use the following parameters with the pg_upgrade
command:
Parameter | Description |
---|---|
--old-port=<pre-upgrade_port> | The port number of the pre-upgrade instance of PostgreSQL |
--new-port=<post-upgrade_port> | The port number to use for the post-upgrade instance of PostgreSQL |
For more information, see https://www.postgresql.org/docs/9.6/pgupgrade.html.
Upgrade for CentOS/RHEL
- Install the Postgres repo for yum. Below, PostgreSQL 9.6 is installed.
For CentOS 6.x:
Code Block wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm sudo yum -y install pgdg-centos96-9.6-3.noarch.rpm
For CentOS 7.x:
Code Block wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm sudo yum -y install pgdg-centos96-9.6-3.noarch.rpm
For Red Hat Enterprise Linux 6.x:
Code Block wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm sudo yum -y install pgdg-redhat96-9.6-3.noarch.rpm
For Red Hat Enterprise Linux 7.x:
Code Block wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm sudo yum -y install pgdg-redhat96-9.6-3.noarch.rpm
Install the upgraded version. Below, PostgreSQL 9.6 is installed.
Code Block sudo yum install postgresql96.x86_64 postgresql96-server.x86_64 postgresql96-contrib.x86_64 -y
Create a new data directory for the new database version:
For CentOS 7.x:
Code Block sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
For CentOS 6.x, RHEL 6.x:
Code Block sudo service postgresql-9.6 initdb
For RHEL 7.x:
Code Block sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
Use the following commands to verify that the upgrade is possible:
Code Block su postgres cd ~ /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.3/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.3/data/ --new-datadir=/var/lib/pgsql/9.6/data/ --check
If all is well, you should see a
Clusters are compatible
message.- Stop the old version of the database service as the root user:
CentOS/RHEL:
Code Block sudo service postgresql-9.3 stop
- Run the upgrade as the
postgres
user:CentOS/RHEL:
Code Block su postgres /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.3/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.3/data/ --new-datadir=/var/lib/pgsql/9.6/data/
Upgrade for Ubuntu 14.04 (Trusty)
Steps:
Stop the platform:
Code Block service trifacta stop
Install the upgraded version. Below, PostgreSQL 9.6 is installed.
Code Block sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y
Stop PostgreSQL:
Code Block sudo systemctl stop postgresql service stop postgresql service postgresql stop
Upgrade the PostgreSQL 9.3 version to PostgreSQL 9.6, using the newly installed version:
D s property overflow Code Block sudo su - postgres -c '/usr/lib/postgresql/9.6/bin/pg_upgrade \ -b /usr/lib/postgresql/9.3/bin -B /usr/lib/postgresql/9.6/bin \ -d /var/lib/postgresql/9.3/main/ -D /var/lib/postgresql/9.6/main/ \ -O "-c config_file=/etc/postgresql/9.6/main/postgresql.conf" \ -o "-c config_file=/etc/postgresql/9.3/main/postgresql.conf"'
Remove the old version of PostgreSQL (9.3):
Code Block sudo apt-get remove postgresql-9.3 -y
Restart PostgreSQL and the platform:
Code Block service postgresql start service trifacta start
Excerpt | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Upgrade for Ubuntu 16.04 (Xenial)Steps:
|
Transfer Settings
For all operating systems, you must transfer the settings from your old version of PostgreSQL to the new one.
- Update the port number and any other settings in the platform configuration.
D s config method triconf - Replace all instances of the PostgreSQL port number for the earlier version and replace with the desired port number for the upgrade version.
D s pssql port - Make the above changes and save the file.
- Replace all instances of the PostgreSQL port number for the earlier version and replace with the desired port number for the upgrade version.
Transfer settings from the configuration files for your old database version to the new one. Please review the old and new versions of these files:
Info NOTE: It is risky to perform a straight copy of these configuration files. Settings may change. New ones may be introduced. Setting values specific to to the installation may be overwritten in a copy. Please retain a backup of both versions of each file before migrating settings.
Path to PostgreSQL 9.3 file Path to PostgreSQL 9.6 file /var/lib/pgsql/9.3/data/pg_hba.conf
/var/lib/pgsql/9.6/data/pg_hba.conf
/var/lib/pgsql/9.3/data/postgresql.conf
/var/lib/pgsql/9.6/data/postgresql.conf
- Start the service:
CentOS/RHEL:
Code Block sudo service postgresql-9.6 start
Ubuntu:
Code Block sudo service postgresql start
When the service restarts, you can check the cluster status using the following script:
Code Block ./analyze_new_cluster.sh
After you have completed the database installation, you must review the port number of the newly installed database, which may have changed between versions of the database software. That new port number must be applied through the
. For more information, see Change Database Port.D s item item software Verify datestyle setting.
Info NOTE: If the PostgreSQL instance used by the
was not created as part of theD s platform
, please verify that the PostgreSQL datestyle value begins withD s item item installation ISO
. For more information, see Configure the Databases.- If all is well, restart the platform. See Start and Stop the Platform.
Verify and Cleanup
- Verify operations on all four database:
- Login to the application. See Login.
- Load a dataset from Flow View. See Flow View Page.
- Run a job. See Run Job Page.
- Schedule a job and execute it. See Add Schedule Dialog.
If all of the above tests pass, you can use the following script to delete the old PostgreSQL version and its data directory:
Code Block ./delete_old_cluster.sh
- Restart the
. See Start and Stop the Platform.D s platform