Debian 8 („Jessie“): Postgres Upgrade
Hinweis: Um immer aktuelle Postgres-Versionen bzw. unterschiedliche Postgres-Versionen zur Verfügung zu haben, sollte man das APT-Repository der PostgreSQL Global Development Group (PGDG) einbinden. Mehr dazu findet man im Postgres-Wiki.
Update-Prozess
In meinem Fall habe ich einen Cluster mit Postgres 9.4 laufen und will diesen auf 9.6 updaten. Daher installieren wir zuerst Postgres 9.6
sudo apt-get install postgresql-9.6
Danach löschen wir den main Cluster von Postgres 9.6.
Hier sollte man sehr vorsichtig vorgehen und aufpassen welchen Cluster man löscht.
sudo pg_dropcluster --stop 9.6 main
Zum Abschluss müssen wir noch pg_upgradecluster laufen lassen. Die Syntax dafür ist: sudo pg_upgradecluster -v NEWVERSION OLDVERSION main
sudo pg_upgradecluster –v 9.6 9.4 main Disabling connections to the old cluster during upgrade... Restarting old cluster with restricted connections... Warning: the cluster will not be running as a systemd service. Consider using systemctl: sudo systemctl start postgresql@9.4-main Creating new cluster 9.6/main ... config /etc/postgresql/9.6/main data /var/lib/postgresql/9.6/main locale de_AT.UTF-8 socket /var/run/postgresql port 5434 Warning: systemd does not know about the new cluster yet. Operations like "service postgresql start" will not handle it. To fix, run: sudo systemctl daemon-reload Disabling connections to the new cluster during upgrade... Warning: the cluster will not be running as a systemd service. Consider using systemctl: sudo systemctl start postgresql@9.6-main Roles, databases, schemas, ACLs... Fixing hardcoded library paths for stored procedures... Upgrading database icinga2_bu... Analyzing database icinga2_bu... Fixing hardcoded library paths for stored procedures... Upgrading database icingaweb... Analyzing database icingaweb... Fixing hardcoded library paths for stored procedures... Upgrading database icinga2... Analyzing database icinga2... Fixing hardcoded library paths for stored procedures... Upgrading database postgres... Analyzing database postgres... Fixing hardcoded library paths for stored procedures... Upgrading database rtest... Analyzing database rtest... Fixing hardcoded library paths for stored procedures... Upgrading database template1... Analyzing database template1... Re-enabling connections to the old cluster... Re-enabling connections to the new cluster... Copying old configuration files... Copying old start.conf... Copying old pg_ctl.conf... Copying old server.crt... Copying old server.key... Copying old root.crt... Stopping target cluster... sudo systemctl stop postgresql@9.6-main Stopping old cluster... sudo systemctl stop postgresql@9.4-main Disabling automatic startup of old cluster... Configuring old cluster to use a different port (5434)... Starting target cluster on the original port... Warning: the cluster will not be running as a systemd service. Consider using systemctl: sudo systemctl start postgresql@9.6-main Success. Please check that the upgraded cluster works. If it does, you can remove the old cluster with pg_dropcluster 9.4 main
Und am Ende kann man noch den alten Cluster löschen
sudo pg_dropcluster 9.4 main