Re: pg_ctl with unix domain socket? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_ctl with unix domain socket?
Date
Msg-id 200909010634.22466.aklaver@comcast.net
Whole thread Raw
In response to pg_ctl with unix domain socket?  (Josef Wolf <jw@raven.inka.de>)
Responses Re: pg_ctl with unix domain socket?  (Josef Wolf <jw@raven.inka.de>)
List pgsql-general
On Tuesday 01 September 2009 4:28:22 am Josef Wolf wrote:
> Hello,
>
> I have created a fresh cluster with
>
>    initdb -D /some/path/pgtest
>
> I can start postgres to run on unix domain socket serving this cluster
> with:
>
>    postgres -D /some/path/pgtest -h '' -k /some/path/pgtest
>
> But I'd like to use pg_ctl instead, in order to have clean control:
>
>    PGPORT=/some/path/pgtest pg_ctl -D/some/path/pgtest -l postgreslog start
>
>
> Any hints how to use pg_ctl to start/stop postgresql on a unix domain
> socket?

1) In postgresql.conf make listen_addresses empty per instructions:

http://www.postgresql.org/docs/8.4/interactive/runtime-config-connection.html#GUC-LISTEN-ADDRESSES
listen_addresses (string)

    Specifies the TCP/IP address(es) on which the server is to listen for
connections from client applications. The value takes the form of a
comma-separated list of host names and/or numeric IP addresses. The special
entry * corresponds to all available IP interfaces. If the list is empty, the
server does not listen on any IP interface at all, in which case only
Unix-domain sockets can be used to connect to it. The default value is
localhost, which allows only local "loopback" connections to be made. This
parameter can only be set at server start.

2) Use the -o switch to pass commands to postgres. See below:

http://www.postgresql.org/docs/8.4/interactive/app-pg-ctl.html
-o options

    Specifies options to be passed directly to the postgres command.

    The options are usually surrounded by single or double quotes to ensure that
they are passed through as a group.

--
Adrian Klaver
aklaver@comcast.net

pgsql-general by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: pg_ctl with unix domain socket?
Next
From: Michael Glaesemann
Date:
Subject: Re: Keys and indexes