pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Browne <cbbrowne@acm.org>
To: pgsql-admin@postgresql.org
Subject: Re: Another Data directory for second database - feasible?
Date: Fri, 22 Apr 2005 14:44:00 -0400
Message-ID: <60hdhy1wjz.fsf@dba2.int.libertyrms.com> (raw)
References: <C45835824D00A844BBD0F032D5CDED920116DA52@pisgana01sxch01.ana.firstamdata.com>

htomeh@firstam.com ("Tomeh, Husam") writes:
> I have a postgres installation with one database on a server. I'd need
> to create another database; however, I'm curious if there's a way to
> create the second database in a different directory than the existing
> one. Is that feasible and how? Or does postgres only point to one data
> directory?  Thanks in advance.

We have plenty of servers with multiple databases, handled in just
this fashion.

At the simplest level, it involves running initdb three times, on
three directories:

$ initdb -D /opt/DB1
$ initdb -D /opt/DB2
$ initdb -D /opt/DB3
$ vi /opt/DB?/postgresql.conf
[change port numbers for each]
$ for db in 1 2 3; do
  pg_ctl -D /opt/DB$db start
done

You probably want to set up some set of "init" scripts that manage
telling the instances where to stow log files and such, and which can
be auto-started upon system bootup.

One of my coworkers has built a really nice init script that's good at
building the directory structure where the DBs will be stowed, hence...

$ vi init_db3.sh
[modify config]
$ ./init_db3.sh mkdir
[builds directory structure]
$ ./init_db3.sh initdb
[runs initdb for you]
$ ./init_db3.sh start

At one point, he was trying to come up with a way of releasing it to
the community; hopefully poking Drew can lead to that coming
available, someday...
-- 
(format nil "~S@~S" "cbbrowne" "acm.org")
http://www.ntlug.org/~cbbrowne/sap.html
Rules of the Evil Overlord #78.  "I will not tell my Legions of Terror
"And he must  be taken alive!" The command will be:  ``And try to take
him alive if it is reasonably practical.''"
<http://www.eviloverlord.com/;



view thread (7+ messages)  latest in thread

Message-ID: <60hdhy1wjz.fsf@dba2.int.libertyrms.com>
Permalink:  ../60hdhy1wjz.fsf@dba2.int.libertyrms.com/
Also on:    postgresql.org/message-id/60hdhy1wjz.fsf@dba2.int.libertyrms.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: cbbrowne@acm.org
  Subject: Re: Another Data directory for second database - feasible?
  In-Reply-To: <60hdhy1wjz.fsf@dba2.int.libertyrms.com>
  References: <C45835824D00A844BBD0F032D5CDED920116DA52@pisgana01sxch01.ana.firstamdata.com> <60hdhy1wjz.fsf@dba2.int.libertyrms.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox