User Tools

Site Tools


ubuntu_upgrade_pg

This is an old revision of the document!


1. Create a snapshot with XenServer

Stop the database to make sure snapshot is consistent.

# service postgresql stop
 * Stopping PostgreSQL 9.3 database server
   ...done.
# xe vm-snapshot new-name-label="Pre PG 9.4 install" vm=exampleVMname
26441bbe-9e47-5590-a93f-5b3cd2ddf9b7

2. Remove the existing postgresql (Ubuntu) packages

# apt-get remove postgresql-\*
# apt-get autoremove

3. Install the PGDG repo

# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# apt-get update

4. 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-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

5. Remove the new PG server empty “cluster”

# sudo -u postgres pg_dropcluster 9.4 main

6. Perform an upgrade which does a binary copy of the existing database

# sudo -u postgres pg_upgradecluster -v 9.4 9.3 main
Stopping old cluster...
Disabling connections to the old cluster during upgrade...
Restarting old cluster with restricted connections...
Creating new PostgreSQL cluster 9.4/main ...
ubuntu_upgrade_pg.1547522408.txt.gz · Last modified: 2020/02/13 22:55 (external edit)

free spam filter