Re: Is it possible to control the location of the lock file when starting postgres?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Steve Langlois <steve(dot)langlois(at)tavve(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is it possible to control the location of the lock file when starting postgres?
Date: 2016-07-20 23:40:03
Message-ID: 02ecbe10-29ca-5aab-8c55-3f64396a84d9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/20/2016 10:44 AM, Steve Langlois wrote:
> Steve Langlois <steve(dot)langlois(at)tavve(dot)com> writes:
>
>> 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
>
> I was able to resolve this issue using -k /tmp with postmaster:
>
> postmaster -k "/tmp" -D "/usr/xxx/databases/pgsql/data"
>
> In postgresql.conf I have
>
> listen_addresses = 'localhost'
> unix_socket_directories = '/tmp'
>
> However when I try to connect with psql
>
> [13:27:08 slanglois(at)tron data]$ psql postgres
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
>
> The lock file is in /tmp

Tom Lane addressed that in his reply to your post, here:

https://www.postgresql.org/message-id/16354.1468965669%40sss.pgh.pa.us

>
> [13:28:02 slanglois(at)tron data]$ ls -al /tmp/.*PGSQL*
> srwxrwxrwx 1 slanglois eng 0 Jul 20 13:19 /tmp/.s.PGSQL.5432
> -rw------- 1 slanglois eng 59 Jul 20 13:19 /tmp/.s.PGSQL.5432.lock
>
> even though I have the following in pg_hba.conf
>
> local all all trust
>
> I tried to specify the host but it still doesn't connect
>
> [13:32:24 slanglois(at)tron data]$ psql -h localhost postgres
> psql: FATAL: no pg_hba.conf entry for host "::1", user "slanglois",
> database "postgres", SSL off
>
> To get it to connect I have to add the following to pg_hba.conf
>
> host all all ::1/128 trust
>
> I was going to put this under a new subject but it seems to me like it
> is still related to the lock file being expected in /var/run/postgres
> when it is trying to connect even though I changed it to /tmp.
>
> Why is the local connection not working without having to add host
> ::1/128 to the pg_hba.conf file. I thought specifying local all all
> trust would allow any local connection.
>
>
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Langlois 2016-07-20 23:48:11 Re: Is it possible to control the location of the lock file when starting postgres?
Previous Message Jonathan Eastgate 2016-07-20 23:06:27 Re: BDR Cluster vs DB Config