PostgreSQL 9.3 Upgrade to 9.4

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.