Preface:
There are two ways to upgrade PostgreSQL by using Pg_dumpall Backup and importing to a new version.
The other is that this article uses the Pg_upgrade method upgrade to copy the old database files from the file level to the new version
Note:
Before upgrading, it is best to back up important data before upgrading after testing environment test
Environment:
System: centos6.x x86 has PostgreSQL 9.3 installed
Upgrade steps:
First install PostgreSQL 9.4
First, install 9.4 of the Yum source
Yum Install-y http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
second, the installation of PostgreSQL 9.4
Yum install-y postgresql94-server Postgresql94-contrib
Initializing the database
/etc/init.d/postgresql-9.4 Initdb
Third, start the upgrade
First you need to turn off postgresql9.3
/etc/init.d/postgresql-9.3 stop
Switch to Postgres user
Su-postgres
To perform an upgrade command
/usr/pgsql-9.4//bin/pg_upgrade-v-d/var/lib/pgsql/9.3/data/-d/var/lib/pgsql/9.4/data/-b/usr/pgsql-9.3/bin/-b/us r/pgsql-9.4/bin/
Option:-B old Version bin directory
-B New Version directory
-D old version Data directory
-D new version of data directory
The following information will be prompted when the upgrade is successful:
Upgrade Complete----------------Optimizer statistics is not transferred by Pg_upgrade so,once you start the new server, C Onsider running:analyze_new_cluster.shRunning This script would delete the old cluster ' s data files:delete_old_clus ter.sh
Switch to root boot 9.4
/etc/init.d/postgresql-9.4 start
Switch to Postgres execute the following script
SH analyze_new_cluster.sh
Delete old version Data directory (optional)
SH delete_old_cluster.sh
finally:
The data upgrade is over, but if you change the pg_hba.conf or other profile, don't forget to change it in the new version.
Reference: http://www.postgresql.org/docs/9.4/static/pgupgrade.html
Pg_dumpall upgrade See: http://www.postgresql.org/docs/9.4/static/upgrading.html
PostgreSQL Source: http://yum.postgresql.org/repopackages.php
PostgreSQL 9.3 installation See http://my.oschina.net/firxiao/blog/295027
PostgreSQL 9.3 Upgrade to 9.4