2

I have an Amazon EC2 instance running PostgreSQL 9.1. I am pointing to the RedHat repo for PostgreSQL. Now that 9.2 is out, how do I upgrade? This is new to me.

n8gard
  • 123
  • 4
  • You'd wait until the package is available from the repo, then do `yum update`. – ceejayoz Sep 18 '12 at 20:23
  • Ah. I wasn't sure if minor releases would show. Thanks @ceejayoz – n8gard Sep 18 '12 at 20:25
  • @ceejayoz Actually, the Amazon packaging for PostgreSQL is dangerously wrong, and can result in an unusable DB if you just update. It updates from 9.1 to 9.2 without `pg_upgrade` or a dump and reload. See http://people.planetpostgresql.org/andrew/index.php?/archives/297-Amazons-serious-PostgreSQL-packaging-blunder.html and Amazon's "answer" here: http://aws.amazon.com/amazon-linux-ami/faqs/#postgresql9 – Craig Ringer Nov 06 '12 at 05:03

2 Answers2

1
  1. You can use the PGDG repo RPMs available here (just wget and rpm -i). Then, you should probably use pg_dump[all] to snapshot your databases/clusters, verify the dumps, uninstall the old version of Postgres, and install the new version. Restore the dumps, and you're good to go.

  2. For a slightly faster alternative (which I haven't used), you could use the upgrade utilities that I hear are available via the postgresql-contrib packages to perform the above process in an automated/managed fashion.

  3. A third alternative, if downtime is absolutely unacceptable during an upgrade dump/restore, is to start a second instance of Postgres (the new version), and replicate your data from the old to the new using Slony or similar. That will probably not be easy to set up, however. I'd suggest just scheduling some maintenance, and using option 1 or 2.

Zac B
  • 841
  • 1
  • 15
  • 27
  • `pg_upgrade` is probably the tool you're talking about. If so, it works completely differently to (1), doing an in-place upgrade. See http://www.postgresql.org/docs/current/static/pgupgrade.html – Craig Ringer Nov 06 '12 at 05:03
0

On the Amazon Linux EC2, you can install the newer version of postgres via

sudo amazon-linux-extras install postgresql12

To list the Amazon Linux add-on services use the command:

amazon-linux-extras list

Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library

Sandy
  • 141
  • 1