Solution: Second postmaster / second DB cluster

Поиск
Список
Период
Сортировка
От Oli Sennhauser
Тема Solution: Second postmaster / second DB cluster
Дата
Msg-id 3f8fa9ea_4@news.bluewin.ch
обсуждение исходный текст
Ответ на Re: Second postmaster / second DB cluster  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-admin
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


В списке pgsql-admin по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: [PERFORM] backup/restore - another area.
Следующее
От: Greg Reeves
Дата:
Сообщение: Postgresql having trouble serving over 1000 connections