Re: Is it possible to control the location of the lock file when starting postgres? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Is it possible to control the location of the lock file when starting postgres?
Date
Msg-id ba696b74-8978-5892-9476-cf28ae4e2a27@aklaver.com
Whole thread Raw
In response to Is it possible to control the location of the lock file when starting postgres?  (Steve Langlois <steve.langlois@tavve.com>)
List pgsql-general
On 07/19/2016 02:49 PM, Steve Langlois wrote:
> Using Postgres 9.2 with CentOS7.
>
>
> I ran
>
>
> + /usr/bin/initdb --pgdata=/usr/xxx/databases/pgsql/data --auth=ident
>
> without issue however when I try to start the database it complains
> about the lockfile.
>
> FATAL:  could not create lock file
> "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied

How are you starting Postgres?

If from system init script then the directory made be set there.
See below also.

>
> I know I can change permissions of /var/run of course but I want to
> change the location of the lock file to a directory I already have
> access to. So I really want to change the default location of the lock
> file to something other than /var/run. I've checked the options to
> initdb as well as looking at the various files in the data directory,
> pg_hba.conf, pg_ident.conf, etc.

https://www.postgresql.org/docs/9.2/static/runtime-config-connection.html

unix_socket_directory (string)

     Specifies the directory of the Unix-domain socket on which the
server is to listen for connections from client applications. The
default is normally /tmp, but can be changed at build time. This
parameter can only be set at server start.

     In addition to the socket file itself, which is named .s.PGSQL.nnnn
where nnnn is the server's port number, an ordinary file named
.s.PGSQL.nnnn.lock will be created in the unix_socket_directory
directory. Neither file should ever be removed manually.

     This parameter is irrelevant on Windows, which does not have
Unix-domain sockets.


>
> Thank you.
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Steve Langlois
Date:
Subject: Re: Is it possible to control the location of the lock file when starting postgres?
Next
From: Tom Lane
Date:
Subject: Re: Is it possible to control the location of the lock file when starting postgres?