Re: [GENERAL] Unable to start postgresql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Unable to start postgresql
Дата
Msg-id 13879.1489004009@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] Unable to start postgresql  (John Iliffe <john.iliffe@iliffe.ca>)
Ответы Re: [GENERAL] Unable to start postgresql  (John Iliffe <john.iliffe@iliffe.ca>)
Список pgsql-general
John Iliffe <john.iliffe@iliffe.ca> writes:
> I tried psql but it won't work, as expected, because socket 5432 is not
> available.

Actually, that's not all that expected.  psql by default would try to
connect via a Unix socket, so it wouldn't matter whether or not the
postmaster had been able to open an IPv4 port.  The most likely reason
for failing to connect via Unix socket is looking in the wrong directory
for the socket, viz "/tmp" vs "/var/run/postgresql", which is why Adrian
is pressing you about other Postgres installations on the machine.  If
your psql session is using a Red Hat-supplied libpq.so then it will likely
look in /var/run/postgresql, whereas this stock-sources postmaster is going
to have put it in /tmp by default.  (You could adjust the
unix_socket_directories parameter to fix that.)  It would also help to
pay close attention to the error message psql gives when it fails to
connect.

Even if you are doing "psql -h localhost", I'm pretty sure "localhost"
will resolve as IPv6 not IPv4 (ie ::1 not 127.0.0.1) on Fedora 25 --- it
does on mine.  So if the postmaster successfully opened an IPv6 port,
which I think it would do by default, then it still wouldn't matter that
the IPv4 port wasn't there; the issue should still be masked.

FWIW, this is what I see for network sockets when lsof'ing a stock
postmaster on current Fedora 25:

...
postmaste 20082  tgl    3u  IPv6              37256      0t0     TCP localhost:postgres (LISTEN)
postmaste 20082  tgl    4u  IPv4              37257      0t0     TCP localhost:postgres (LISTEN)
postmaste 20082  tgl    5u  unix 0xffff9eb3435cfc00      0t0   37259 /tmp/.s.PGSQL.5432 type=STREAM
...

or with -n it looks like

postmaste 20082  tgl    3u  IPv6              37256      0t0     TCP [::1]:postgres (LISTEN)
postmaste 20082  tgl    4u  IPv4              37257      0t0     TCP 127.0.0.1:postgres (LISTEN)
postmaste 20082  tgl    5u  unix 0xffff9eb3435cfc00      0t0   37259 /tmp/.s.PGSQL.5432 type=STREAM

What I am suspicious of at this point is that the root of the problem is
networking misconfiguration on your machine, such that IPv4 doesn't work
at all; given the platform's bias towards IPv6 for loopback, you might
not have noticed otherwise.  You might check what results you get from
"ping ::1" vs "ping 127.0.0.1" vs "ping localhost".

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: [GENERAL] too may LWLocks
Следующее
От: John Iliffe
Дата:
Сообщение: Re: [GENERAL] Unable to start postgresql