Database Reference
In-Depth Information
How to do it...
Core PostgreSQL easily allows multiple servers running on the same system. There are a few
wrinkles of which to be aware.
Some installer versions create a PostgreSQL data directory named "data". It then gets a
little difficult to have more than one data directory without different directory structures and
names.
The Debian/Ubuntu layout is specifically designed to allow multiple servers, potentially
running with different software release levels.
To create an additional data directory, run the following:
sudo pg_createcluster 9.0 database2
which can then be started using the following:
sudo pg_createcluster 9.0 database2
which will create an additional database cluster at version 9.0, named "database2", with files
stored in /var/lib/postgresql/9.0/database2 .
With Red Hat systems, you will need to run initdb directly, selecting your directories
carefully. Something like the following:
initdb -D /var/lib/pgsql/database2
then, modify the port parameter in the postgresql.conf , and then start using:
pg_ctl -D /var/lib/pgsql/database2 start
which will create an additional database cluster at the default server version with files stored
in /var/lib/pgsql/database2 .
You can set up the server with chkconfig also.
How it works...
PostgreSQL servers are controlled using pg_ctl . Everything else is a wrapper of some
kind around it. The only constraints on running multiple versions of PostgreSQL come
from file locations and naming conventions. Everything else is straightforward. Having
said that, the Debian/Ubuntu design is currently the only one that makes it actually easy
to run multiple servers.
 
Search WWH ::




Custom Search