pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oli Sennhauser <oli.sennhauser@bluewin.ch>
To: pgsql-admin@postgresql.org
Subject: Solution: Second postmaster / second DB cluster
Date: Fri, 17 Oct 2003 10:36:47 +0200
Message-ID: <3f8fa9ea_4@news.bluewin.ch> (raw)
In-Reply-To: <20031016100239.C52937@megazone.bigpanda.com>
References: <3F8EB07D.7040603@bluewin.ch>
	<20031016100239.C52937@megazone.bigpanda.com>

Stephan Szabo wrote:
> On Thu, 16 Oct 2003, Oli Sennhauser wrote:
> 
> 
>>I would like to start a second postmaster on my server.
>>First problem was the lock file /tmp/.s.PGSQL.5432.lock
>>and its socket. But you can workaround that by the -k
>>parameter. So I was able to start at least 3 clusters...
> 
> 
> If you want to use separate directories for the socket, you
> need to use -h <directory>  (and -p <port> if it's not the default)
> when connecting with psql.  However, you probably just want to
> use different port numbers to start the postmasters and then use
> psql -p <port> to connect.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

 >>Thank you for answering.
 >>>
 >>> Do you mean -k <directory> (or -h <hostname>)? -k <directory> is 
exactly
 >>> what I did. And it did not work in my case. In my opinion we should not
 >>> need -i and -h in this example, because I only want to do local 
connects.
 >
 >psql -h /u00/app/pgsql/data/CLUSTER1
 >means use a local socket located in that directory (with the
 >"port" number of 5432 - which is used in determing the filename).
 >
 >>From the 7.3 psql manpage:
 >-h hostname
 >--host hostname
 >Specifies the host name of the machine on which the postmaster is
 >running. If host begins with a slash, it is used as the directory for >the
 >Unix-domain socket.

Ok, now I understand it! Thank you verry much Stephan

Here is my final solution:

$ CLUSTER1
$ pg_ctl start -D $PG_DATA -l $PG_DATA/$PG_CID.log -o "-k $PG_DATA 
          -p $PG_PORT"
postmaster successfully started

$ CLUSTER2
$ pg_ctl start -D $PG_DATA -l $PG_DATA/$PG_CID.log -o "-k $PG_DATA 
          -p $PG_PORT"
postmaster successfully started

$ CLUSTER3
$ pg_ctl start -D $PG_DATA -l $PG_DATA/$PG_CID.log -o "-k $PG_DATA 
          -p $PG_PORT"
postmaster successfully started

$ ps -fu postgres
UID        PID  PPID  C STIME TTY        TIME CMD
postgres   402     1  0 10:29 pts/1  00:00:00 
/u00/app/pgsql/products/7.4.0/bin/postmaster -k 
/u00/app/pgsql/data/CLUSTER1 -p 5
postgres   404   402  0 10:29 pts/1  00:00:00 postgres: stats buffer process
postgres   406   404  0 10:29 pts/1  00:00:00 postgres: stats collector 
process
postgres   436     1  0 10:29 pts/1  00:00:00 
/u00/app/pgsql/products/7.4.0/bin/postmaster -k 
/u00/app/pgsql/data/CLUSTER2 -p 5
postgres   438   436  0 10:29 pts/1  00:00:00 postgres: stats buffer process
postgres   439   438  0 10:29 pts/1  00:00:00 postgres: stats collector 
process
postgres   469     1  0 10:29 pts/1  00:00:00 
/u00/app/pgsql/products/7.3.3/bin/postmaster -k 
/u00/app/pgsql/data/CLUSTER3 -p 5
postgres   471   469  0 10:29 pts/1  00:00:00 postgres: stats buffer process
postgres   473   471  0 10:29 pts/1  00:00:00 postgres: stats collector 
process

$ netstat -ap | grep PGSQL
unix  2  [ ACC ]  STREAM  LISTENING  287991 402/postmaster 
/u00/app/pgsql/data/CLUSTER1/.s.PGSQL.5432
unix  2  [ ACC ]  STREAM  LISTENING  288022 436/postmaster 
/u00/app/pgsql/data/CLUSTER2/.s.PGSQL.5434
unix  2  [ ACC ]  STREAM  LISTENING  288051 469/postmaster 
/u00/app/pgsql/data/CLUSTER3/.s.PGSQL.5436

$ CLUSTER1
$ psql -l -h $PG_DATA
         List of databases
    Name    |  Owner   | Encoding
-----------+----------+-----------
  T740A     | postgres | SQL_ASCII
  T740B     | postgres | SQL_ASCII
  template0 | postgres | SQL_ASCII
  template1 | postgres | SQL_ASCII

$ CLUSTER2
$ psql -l -h $PG_DATA
         List of databases
    Name    |  Owner   | Encoding
-----------+----------+-----------
  template0 | postgres | SQL_ASCII
  template1 | postgres | SQL_ASCII

$ CLUSTER3
$ psql -l -h $PG_DATA
         List of databases
    Name    |  Owner   | Encoding
-----------+----------+-----------
  template0 | postgres | SQL_ASCII
  template1 | postgres | SQL_ASCII




Message-ID: <3f8fa9ea_4@news.bluewin.ch>
Permalink:  ../3f8fa9ea_4@news.bluewin.ch/
Also on:    postgresql.org/message-id/3f8fa9ea_4@news.bluewin.ch

 · 

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: oli.sennhauser@bluewin.ch
  Subject: Re: Solution: Second postmaster / second DB cluster
  In-Reply-To: <3f8fa9ea_4@news.bluewin.ch>
  References: <3F8EB07D.7040603@bluewin.ch> <20031016100239.C52937@megazone.bigpanda.com> <3f8fa9ea_4@news.bluewin.ch>

* 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