Re: Unable to connect to Postgresql

From: John Iliffe <john(dot)iliffe(at)iliffe(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: Unable to connect to Postgresql
Date: 2017-04-11 14:33:14
Message-ID: 201704111033.14523.john.iliffe@iliffe.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 10 April 2017 19:37:43 Adrian Klaver wrote:
> On 04/10/2017 01:23 PM, John Iliffe wrote:
> > On Monday 10 April 2017 11:53:35 Daniel Verite wrote:
> >> John Iliffe wrote:
> >>> So, the problem is resolved, although I have no idea why it was
> >>> necessary.
> >>
> >> The key seems to be the PrivateTmp=true in the systemd service.
> >> Apache is not chrooted as demonstrated upthread, but that
> >> setting alone makes the normal, system-wide /tmp inaccessible
> >> to its processes, including the postgres Unix domain socket opened
> >> there.
> >>
> >> I suspect that your attempt to set PrivateTmp=false as a test was
> >> missed by systemd for some reason. You could probably insist
> >> in that direction and eventually make it work, but I don't see
> >> how it's better than the alternative /var/pgsql or localhost through
> >> TCP.
> >>
> >>> Also, I now have several hundred programmes to update to add the
> >>> host path and none of them will now be portable.
> >>
> >> Given that you set two directories: /tmp and /var/pgsql,
> >> I would think you can let the other apps use /tmp as before
> >> and have only Apache use /var/pgsql ?
> >
> > Yes, I will do that, but there are several hundred PHP web page
> > scripts to be updated. Presumably if one script opens two different
> > databases then both of the pg_connect() instances will need to be
> > updated.
>
> Out of curiosity where did you install Postgres from?
>
> The reason I ask it that I was trying to figure why Fedora would invoke
> private /tmp's for services and then have the Postgres socket be only in
> the public /tmp. So I spun up a Fedora 25 instance and did an install of
> Postgres from the Fedora repos and then from the PGDG repos. In either
> case I got a postgresql.conf that had:
>
> unix_socket_directories = '/var/run/postgresql', '/tmp'
>
> Upstream you showed your default as:
>
> unix_socket_directories = '/tmp'
>
> which is what I see when I do a source install.
>
> So did you do a source install or did you copy a postgresql.conf from
> somewhere else?
I downloaded the source from

https://www.postgresql.org/ftp/source/v9.6.2/

and installed according ot the notes included there.
>
> >> Best regards,

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rj Ewing 2017-04-11 17:46:41 dynamic schema modeling and performance
Previous Message Jan de Visser 2017-04-11 12:53:47 Re: Build PostGIS In Windows Using --with-gdalconfig=FILE