Re: postgresql unix socket connections

From: Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: postgresql unix socket connections
Date: 2019-01-09 15:08:53
Message-ID: CA+t6e1k6SQm3RYAYQZGcmXjAUnOV8MNoVvt-xmkhHUk_vUm6Gg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hey Tom,
I'm aware of how I can solve it. I wanted to understand why after
installing the pg 9.6 packages suddenly psql tries to access the socket on
/var/run/postgresql. Does the libpq default unix socket is changed between
those two versions ? (9.6,9.2)

‫בתאריך יום ד׳, 9 בינו׳ 2019 ב-16:55 מאת ‪Tom Lane‬‏ <‪tgl(at)sss(dot)pgh(dot)pa(dot)us
‬‏>:‬

> Mariel Cherkassky <mariel(dot)cherkassky(at)gmail(dot)com> writes:
> > I'm trying to understand some issues that I'm having with the unix_socket
> > settings and pgsql.
> > I have 2 machines with pg v9.2.5 with the same next settings :
> > #listen_addresses = 'localhost'
> > #unix_socket_directory = ''
>
> This will result in the server creating the socket in whatever it thinks
> is the default socket directory. Traditionally PG uses /tmp as the
> default socket directory, and your netstat result is consistent with that:
>
> > unix 2 [ ACC ] STREAM LISTENING 51587140 3729/postgres
> > /tmp/.s.PGSQL.5432
>
> However, this:
>
> > 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"?
>
> shows that your psql is using a libpq that thinks the default socket
> directory is /var/run/postgresql. That's a build-time option, and
> I recall that Red Hat builds their postgresql package that way.
> I'm not 100% sure which way the PGDG RPMs do it.
>
> You could override libpq's default, for instance via "psql -h /tmp".
> But probably you'd be better off removing any packages that provide
> libpq versions that don't match your server.
>
> Alternatively, you could configure the server to create socket
> files in both places.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2019-01-09 15:09:04 Re: postgresql unix socket connections
Previous Message Tom Lane 2019-01-09 14:55:02 Re: postgresql unix socket connections