Cannot connect to postgresql-11 from another machine after boot

Поиск
Список
Период
Сортировка
От Jason Swails
Тема Cannot connect to postgresql-11 from another machine after boot
Дата
Msg-id CAEk9e3pcmikJRo6cQ0COHpu_Z9gLLUeX=tY1w1qOVpzUehCB9A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Cannot connect to postgresql-11 from another machine after boot  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Hi,

I've been struggling with a strange (to me) issue for awhile.  I have PostgreSQL 11.6 installed on my Ubuntu machine with the data directory living on a different drive than the one mounted on /. I was observing the same behavior when my machine was running Gentoo a month ago.

The problem is that after my machine boots, I'm unable to connect to the server from anywhere except localhost.  Running a simple "systemctl restart postgresql" fixes the problem and allows me to connect from anywhere on my LAN.  Here is an example of this behavior:

swails@client ~ $ psql -U postgres -h 192.168.1.3
psql: could not connect to server: Connection refused
Is the server running on host "192.168.1.3" and accepting
TCP/IP connections on port 5432?

swails@client ~ $ ssh 192.168.1.3

swails@server ~ $ sudo systemctl restart postgresql

swails@server ~ $ logout
Connection to 192.168.1.3 closed.

swails@client ~ $ psql -U postgres -h 192.168.1.3
Password for user postgres:

So the first connection attempt fails.  But when I restart the service and try again (doing nothing else in between), the connection attempt succeeds.  My workaround has been to simply restart the service every time my machine reboots, but I'd really like to have a more reliable startup.

Any ideas how to start hunting down the root cause?  I think this started happening after I moved the data directory to another drive.

Thanks,
Jason

--
Jason M. Swails

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

Предыдущее
От: Jason Ralph
Дата:
Сообщение: RE: pg_upgrade —link does it remove table bloat
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Cannot connect to postgresql-11 from another machine after boot