Using the pg_upgrade utility for version upgrade
Here in this recipe, we are going to talk about upgrading a PostgreSQL cluster using pg_upgrade. We will cover the upgrading of the PostgreSQL version from 9.5 to 9.6.
Getting ready
The only prerequisite here is that an existing PostgreSQL cluster must be up and running. The required version here is PostgreSQL Version 9.6. These steps are carried out on a 64 bit CentOS machine.
How to do it...
Here are the steps to upgrade a PostgreSQL machine from version 9.5 to version 9.6 using the pg_upgrade utility:
- Take a full backup of the data directory using a filesystem dump, or use
pg_dumpallto back up the data:cd /opt/pgsql/9.5/ tar -cvf data.tar data
- The next step would to be install the new version of PostgreSQL 9.6, as mentioned previously.
- Now that the new version of PostgreSQL is installed, we make the following configuration changes and then initialize the data directory for the new PostgreSQL Version 9.6 database:
...
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime