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.
2 Answers
You can use the PGDG repo RPMs available here (just
wgetandrpm -i). Then, you should probably usepg_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.For a slightly faster alternative (which I haven't used), you could use the upgrade utilities that I hear are available via the
postgresql-contribpackages to perform the above process in an automated/managed fashion.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.
-
pg_upgradeis probably the tool you're talking about. If so, it works completely differently to (1), doing an in-place upgrade. See postgresql.org/docs/current/static/pgupgrade.htmlCraig Ringer– Craig Ringer2012-11-06 05:03:55 +00:00Commented Nov 6, 2012 at 5:03
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
yum update.pg_upgradeor a dump and reload. See people.planetpostgresql.org/andrew/index.php?/archives/… and Amazon's "answer" here: aws.amazon.com/amazon-linux-ami/faqs/#postgresql9