Skip site navigation (1) Skip section navigation (2)

Re: Poatgresql database on more than one disk

From: "Philip A(dot) Chapman" <pchapman(at)pcsw(dot)us>
To: Barry <bgraetz(at)bigpond(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Poatgresql database on more than one disk
Date: 2004-05-31 19:14:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Tue, 2004-05-25 at 18:33, Barry wrote:
> I would like to be able to use one disk pack for development and the
> other for end user testing / verification (the tape drive can only backup 
> one disk pack completely, not both)
> Is it possible to configure Postgresql to have seperate databases
> on seperate disks ?

One solution is to run two postmasters (two services).  Each would use a
different value for the PGDATA environment variable.

The pro to this is that there would be a greater degree of separation
between your development environment and test environment.  You could
start and stop the development environment service separately from the
test environment, for instance.

The con is that only one postmaster can bind to port 5432 at a time. 
You would have to set up one of the postmasters to use a different
port...  perhaps 5433?

Since you are using RedHat, take a look at /etc/init.d/postgresql.  You
should see where the the PGDATA environment variable is set in the top
of the script.  PGPORT is also set, which is the port number that the
postmaster will use.  (I am using Fedora Core 1 and Fedora Core 2.  I
assume that RedHat's scripts are very similar to this, if not

If I were doing it, I'd probably copy /etc/init.d/postgresql to
/etc/init.d/postgresql_dev and /etc/init.d/postgresql_test.  I'd modify
/etc/init.d/postgresql_test so that it controls my test environment and
/etc/init.d/postgresql_dev so that it controls my development
environment.  I'd use chkconfig to disable the service postgresql and
enable the services postgresql_dev and postgresql_test.  (That way, if
upgrades clobber /etc/init.d/postgresql, you're not left in a bind).

You can contact me off-list if you need more help with this solution.

Philip A. Chapman

Application Development:
Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL
Linux, Windows 9x, Windows NT, Windows 2000, Windows XP

In response to


pgsql-general by date

Next:From: PostgresqlDate: 2004-05-31 20:03:08
Subject: Re: Poatgresql database on more than one disk
Previous:From: linhluongDate: 2004-05-31 16:30:24
Subject: pg_dump question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group