Skip to content

Instantly share code, notes, and snippets.

@moofkit
Created October 16, 2018 03:16
Show Gist options
  • Save moofkit/d098fd34eccd0ede643da4045b67ea2e to your computer and use it in GitHub Desktop.
Save moofkit/d098fd34eccd0ede643da4045b67ea2e to your computer and use it in GitHub Desktop.

After a bit of digging, I believe the issue was that the 9.6 install setup a cluster for the new instance which was interrupting the pg_upgrade. I ended up getting it working by dropping the new cluster and upgrading the 9.3 cluster using pg_upgradecluster from the following gist: https://gist.github.com/delameko/bd3aa2a54a15c50c723f0eef8f583a44

Install packages

sudo apt-get install postgresql-9.6 postgresql-server-dev-9.6 postgresql-contrib-9.6 -y

List clusters. Should show existing (9.3) and newly installed (9.6)

pg_lsclusters

Output:

Ver Cluster Port Status Owner    Data directory               Log file
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log
9.6 main    5433 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.6-main.log

Stop new cluster

sudo pg_dropcluster 9.6 main --stop

Set locale

export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8

Upgrade existing 9.3

sudo pg_upgradecluster 9.3 main

Drop old 9.3 cluster

sudo pg_dropcluster 9.3 main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment