User Tools

Site Tools


ubuntu_upgrade_pg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ubuntu_upgrade_pg [2019/01/14 22:20]
ian
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
  
Line 7: Line 10:
    ...done.    ...done.
 </code> </code>
 +postgresql
 <code> <code>
-# xe vm-snapshot new-name-label="Pre PG 9.4 install" vm=exampleVMname+xenserver# xe vm-snapshot new-name-label="Pre PG 9.4 install" vm=exampleVMname
 26441bbe-9e47-5590-a93f-5b3cd2ddf9b7 26441bbe-9e47-5590-a93f-5b3cd2ddf9b7
 </code> </code>
  
-2. Remove the existing postgresql (Ubuntu) packages+2. Install the PGDG repo
  
 <code> <code>
-# apt-get remove postgresql-\*+sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 
 + 
 +# curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 
 + 
 +# apt-get update
 </code> </code>
 +
 +3. Install the PGDG postgresql upgrade
  
 <code> <code>
-apt-get autoremove+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
 </code> </code>
  
-3Install the PGDG repo+4Remove the new PG server empty "cluster"
  
 <code> <code>
-# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main/etc/apt/sources.list.d/pgdg.list'+# sudo -u postgres pg_dropcluster --stop 9.4 main 
 +</code>
  
-apt-get update+5. Perform an upgrade which does a binary copy of the existing database 
 + 
 +<code> 
 +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 /etc/postgresql/9.4/main 
 +  data   /var/lib/postgresql/9.4/main 
 +  locale en_CA.UTF-
 +  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
 </code> </code>
  
-4Install the PGDG postgresql upgrade+6Remove the old postgresql 9.3 (Ubuntu) packages
  
 <code> <code>
-aptitude install postgresql-9.4 +apt-get remove postgresql postgresql.*-9.3
-The following NEW packages will be installed: +
-  postgresql-9.4 postgresql-client-9.4{a} postgresql-client-common{a} postgresql-common{a} postgresql-contrib-9.4{a}  +
-0 packages upgraded, 5 newly installed, 0 to remove and 111 not upgraded. +
-Need to get 0 B/5,588 kB of archives. After unpacking 25.5 MB will be used. +
-Do you want to continue? [Y/n/?] y+
 </code> </code>
  
-5Remove the new PG server empty "cluster"+<code> 
 +# apt-get autoremove 
 +</code> 
 + 
 +7Proceed with the Ubuntu upgrade
  
 <code> <code>
-sudo -u postgres pg_dropcluster 9.4 main+apt-get dist-upgrade 
 + 
 +# do-release-upgrade
 </code> </code>
  
-6. Perform an upgrade which does a binary copy of the existing database+And restore the PGDG repo
  
 <code> <code>
-# sudo -u postgres pg_upgradecluster -v 9.4 9.main +# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 
-Stopping old cluster... + 
-Disabling connections to the old cluster during upgrade... +# apt update 
-Restarting old cluster with restricted connections... + 
-Creating new PostgreSQL cluster 9.4/main ...+# apt full-upgrade
 </code> </code>
 +
  
ubuntu_upgrade_pg.1547522408.txt.gz · Last modified: 2020/02/13 22:55 (external edit)

free spam filter