Thread: Upgrading from 8.0 to 8.1 on Debian

Upgrading from 8.0 to 8.1 on Debian

From
Assad Jarrahian
Date:
Hi All,
  I am a bit stumped. So I have a couple of Postgresql versions on my
server, namely 8.0 and 8.1 (using Debian package manager). I am trying
to get 8.1 to be the default database and delete 8.0

I used pg_dump to dump my db's into a file (Question: Where do I dump
the data of the tables in the db?).

I tried running pg_upgradecluster as shown below, and I get an error.

jarraa@proximity:/etc/postgresql-common$ sudo pg_upgradecluster 8.0 main
Error: target cluster 8.1/main already exists

I went through /usr/share/doc/postgresql-common/architecture.html and
am a little lost.

What would be the step by step process in this case? I would like to
backup the db (plus its data), then point everything to the new
Postgresql version and get all my db's on to that.

Any help would be much appreciated.
Thanks.
-assad

Re: Upgrading from 8.0 to 8.1 on Debian

From
Stephen Frost
Date:
* Assad Jarrahian (jarraa@gmail.com) wrote:
> jarraa@proximity:/etc/postgresql-common$ sudo pg_upgradecluster 8.0 main
> Error: target cluster 8.1/main already exists

This is complaining that you already did an initdb on the 8.1 version, I
believe.

> What would be the step by step process in this case? I would like to
> backup the db (plus its data), then point everything to the new
> Postgresql version and get all my db's on to that.

Basically you should be able to modify
/etc/postgresql/8.1/postmaster.conf (iirc) and get the 8.1 postmaster
running on some alternate port.  You can then use pg_restore to load up
all your data from your 8.0 install into your 8.1 install.  Then you
just need to stop your 8.0 postmaster, modify the port for your 8.1
postmaster to the 'normal' one and restart it.

Basically, Debian lets you have both installed.  Once you're happy with
your 8.1 install you can remove/purge your 8.0 packages.  Just to note:
I havn't actually done this myself yet (been thinking about it though).
Also, this isn't entirely appropriate for this list (being
a Debian-specific question).  You can file a bug on
http://bugs.debian.org asking for additional documentation to be
included in the package, or if you run into problems.

    Enjoy,

        Stephen

Attachment

Re: Upgrading from 8.0 to 8.1 on Debian

From
Oliver Elphick
Date:
On Fri, 2005-11-18 at 13:49 -0700, Assad Jarrahian wrote:
> Hi All,
>   I am a bit stumped. So I have a couple of Postgresql versions on my
> server, namely 8.0 and 8.1 (using Debian package manager). I am trying
> to get 8.1 to be the default database and delete 8.0
>
> I used pg_dump to dump my db's into a file (Question: Where do I dump
> the data of the tables in the db?).

?? The data is included in the dump.  Put it anywhere that has room for
it all.  In fact, you should use pg_dumpall, otherwise you lose the
user/group information.  But in fact you don't need to do this, except
as insurance...

> I tried running pg_upgradecluster as shown below, and I get an error.
>
> jarraa@proximity:/etc/postgresql-common$ sudo pg_upgradecluster 8.0 main
> Error: target cluster 8.1/main already exists
>
> I went through /usr/share/doc/postgresql-common/architecture.html and
> am a little lost.
>
> What would be the step by step process in this case? I would like to
> backup the db (plus its data), then point everything to the new
> Postgresql version and get all my db's on to that.

...pg_upgradecluster is the way to go.

First, if you have nothing yet in 8.1/main, use pg_dropcluster to get
rid of it:

   /etc/init.d/postgresql-8.1 stop
   pg_dropcluster 8.1 main

(I do two separate commands, rather than use --stop-server, for fear
that a typo might destroy the wrong database!)

If you already have data in 8.1, stop its server and rename the cluster
by changing its name:

   mv /etc/postgresql/8.1/main /etc/postgresql/8.1/newname

and alter its postgresql.conf to give it an appropriate port - not 5432.

After that:

   pg_upgradecluster 8.0 main

will do the job, including renumbering the ports so that 8.1/main is the
default.  Check that it is working and then use pg_dropcluster to
destroy the old one.

These commands have to be run as root; postgres does not have sufficient
permissions to modify the configuration files.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html