This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ubuntu_upgrade_pg [2019/01/14 21:48] ian created |
ubuntu_upgrade_pg [2020/02/13 22:55] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Upgrade of PostgreSQL and Ubuntu upgrade ====== | ||
+ | |||
+ | |||
1. Create a snapshot with XenServer | 1. Create a snapshot with XenServer | ||
+ | Stop the database to make sure snapshot is consistent. | ||
< | < | ||
- | # xe vm-snapshot new-name-label=" | + | # service postgresql stop |
+ | * Stopping PostgreSQL 9.3 database server | ||
+ | | ||
+ | </ | ||
+ | postgresql | ||
+ | < | ||
+ | xenserver# xe vm-snapshot new-name-label=" | ||
26441bbe-9e47-5590-a93f-5b3cd2ddf9b7 | 26441bbe-9e47-5590-a93f-5b3cd2ddf9b7 | ||
+ | </ | ||
+ | |||
+ | 2. Install the PGDG repo | ||
+ | |||
+ | < | ||
+ | # sudo sh -c 'echo "deb http:// | ||
+ | |||
+ | # curl https:// | ||
+ | |||
+ | # apt-get update | ||
+ | </ | ||
+ | |||
+ | 3. Install the PGDG postgresql upgrade | ||
+ | |||
+ | < | ||
+ | # aptitude install postgresql-9.4 | ||
+ | The following NEW packages will be installed: | ||
+ | postgresql-9.4 postgresql-client-9.4{a} postgresql-contrib-9.4{a} | ||
+ | 0 packages upgraded, 3 newly installed, 0 to remove and 115 not upgraded. | ||
+ | Need to get 0 B/5,281 kB of archiv | ||
+ | </ | ||
+ | |||
+ | 4. Remove the new PG server empty " | ||
+ | |||
+ | < | ||
+ | # sudo -u postgres pg_dropcluster --stop 9.4 main | ||
+ | </ | ||
+ | |||
+ | 5. Perform an upgrade which does a binary copy of the existing database | ||
+ | |||
+ | < | ||
+ | # service postgresql stop | ||
+ | |||
+ | # pg_upgradecluster -v 9.4 9.3 main | ||
+ | Disabling connections to the old cluster during upgrade... | ||
+ | Restarting old cluster with restricted connections... | ||
+ | Creating new cluster 9.4/main ... | ||
+ | config / | ||
+ | data / | ||
+ | locale en_CA.UTF-8 | ||
+ | port 5433 | ||
+ | Disabling connections to the new cluster during upgrade... | ||
+ | ... | ||
+ | Success. Please check that the upgraded cluster works. If it does, | ||
+ | you can remove the old cluster with | ||
+ | |||
+ | pg_dropcluster 9.3 main | ||
+ | </ | ||
+ | |||
+ | 6. Remove the old postgresql 9.3 (Ubuntu) packages | ||
+ | |||
+ | < | ||
+ | # apt-get remove postgresql postgresql.*-9.3 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # apt-get autoremove | ||
+ | </ | ||
+ | |||
+ | 7. Proceed with the Ubuntu upgrade | ||
+ | |||
+ | < | ||
+ | # apt-get dist-upgrade | ||
+ | |||
+ | # do-release-upgrade | ||
+ | </ | ||
+ | |||
+ | And restore the PGDG repo | ||
+ | |||
+ | < | ||
+ | # sudo sh -c 'echo "deb http:// | ||
+ | |||
+ | # apt update | ||
+ | |||
+ | # apt full-upgrade | ||
</ | </ | ||