Re: [GENERAL] Unable to start postgresql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Unable to start postgresql
Дата
Msg-id 25543.1489081789@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:
> On Thursday 09 March 2017 12:08:01 Tom Lane wrote:
>> AFAICS, the explanation must be that getaddrinfo() returned two IPv4
>> addresses, one of which got bound successfully and the other not.
>> The bleat is about the non-working address, but you still ended up
>> with a working IPv4 socket.
>>
>> This recalls my earlier theory that there's something weird about
>> your networking configuration, but now we have a bit more information
>> about what the weirdness must look like.  It might be useful to have
>> a look at "ifconfig" output on your machine.

> [root@prod04 John]# ifconfig -a
> enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.1.6  netmask 255.255.255.255  broadcast 192.168.1.6
>         inet6 fe80::62d4:f478:8bbb:34a1  prefixlen 64  scopeid 0x20<link>
> ...
> lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
>         inet 127.0.0.1  netmask 255.0.0.0
>         inet6 ::1  prefixlen 128  scopeid 0x10<host>

Ah-hah.  You earlier showed your /etc/hosts file:

----------------------------
[root(at)prod04 John]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4
        localhost4.localdomain4
::1         localhost localhost.localdomain localhost6
        localhost6.localdomain6
192.168.1.8 prod03.coaxpublications.ca localhost
192.168.1.1 default
----------------------------

So given that, getaddrinfo is going to resolve "localhost" into the
set of addresses "127.0.0.1", "::1", and "192.168.1.8".  PG successfully
binds to the first two, which match your "lo" interface, while it fails
to bind to the last one because *that ain't the address on your ethernet
card*.  The postmaster will start anyway, as long as it was able to bind
to at least one of the addresses reported for "localhost", so the only
real damage is the confusing log message.

We could probably have saved a whole lot of time here if the "could not
bind" bleat would print out the specific address that it's failing to
bind to.  I have a really vague recollection of having wanted to do that
and not having found any portable library function for converting a
struct addrinfo to a string, but that was years if not decades ago.
We oughta try harder.

(BTW, it strikes me as pretty insecure to list a non-loopback address
as part of "localhost", but that's a different topic.)

            regards, tom lane


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

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