Re: 2 postgresql processes on the same machine ?

From: Robby Russell <robby(at)planetargon(dot)com>
To: Jean-Guillaume LALANNE <jeanguillaume(dot)lalanne(at)capgemini(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 2 postgresql processes on the same machine ?
Date: 2004-07-23 04:32:20
Message-ID: 1090557140.2575.69.camel@vacant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2004-07-22 at 06:02, Jean-Guillaume LALANNE wrote:
> Hi,
>
> I am pretty new to the postgresql community.
> My question may seem a little bit strange but
> I'd like to know if it is possible to run 2
> postgresql processes with 2 separate databases on the
> same machine (change of the ports, different paths to
> logs, ...)?
>
> Thanks in advance for your answers.
>
> Best Regards,
>
> Jean-Guillaume LALANNE

Yep, this is quite simple actually.

For example, say you want user X to have their own DB instance that they
can stop/start when ever they choose.

(logs into shell as new user)

[allison(at)vacant allison]$ initdb --username=admin -W pgdata
The files belonging to this database system will be owned by user
"allison".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.

creating directory pgdata... ok
creating directory pgdata/base... ok
creating directory pgdata/global... ok
creating directory pgdata/pg_xlog... ok
creating directory pgdata/pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in pgdata/base/1... ok
initializing pg_shadow... ok
Enter new superuser password:
Enter it again:
setting password... ok
enabling unlimited row size for system tables... ok
initializing pg_depend... ok
creating system views... ok
loading pg_description... ok
creating conversions... ok
setting privileges on built-in objects... ok
creating information schema... ok
vacuuming database template1... ok
copying template1 to template0... ok

Success. You can now start the database server using:

/usr/bin/postmaster -D pgdata
or
/usr/bin/pg_ctl -D pgdata -l logfile start

...then edit the file:
joe pgdata/postgresql.conf
Change #port = 5432
(port of your choice)

save file

then issue:

> /usr/bin/pg_ctl -D pgdata -l logfile start
> postmaster successfully started

Voila. :-)

-Robby

--
Robby Russell | Owner.Developer.Geek
PLANET ARGON | www.planetargon.com
Portland, OR | robby(at)planetargon(dot)com
503.351.4730 | blog.planetargon.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve 2004-07-23 06:11:25 please please please PLEASE help!
Previous Message Tom Lane 2004-07-23 02:31:35 Re: ERROR: AllocSetFree: cannot find block containing chunk 507928