From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Jason Swails <jason(dot)swails(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Cannot connect to postgresql-11 from another machine after boot |
Date: | 2020-02-14 05:03:48 |
Message-ID: | b9f567c2-26e9-4ffe-1630-d7994e32c673@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2/13/20 9:02 PM, Adrian Klaver wrote:
> On 2/13/20 7:54 PM, Jason Swails wrote:
>> 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(at)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(at)client ~ $ ssh 192.168.1.3
>>
>> swails(at)server ~ $ sudo systemctl restart postgresql
>>
>> swails(at)server ~ $ logout
>> Connection to 192.168.1.3 closed.
>>
>> swails(at)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.
>
> I would start by looking in the system log to see what it records when
> the service tries to start on reboot.
Hit send to soon. At a guess the Postgres service is starting before the
drive is mounted.
>
>>
>> Thanks,
>> Jason
>>
>> --
>> Jason M. Swails
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Nick Renders | 2020-02-14 12:39:10 | PL/pgSQL question about EXCEPTION clause & corrupt records |
Previous Message | Adrian Klaver | 2020-02-14 05:02:04 | Re: Cannot connect to postgresql-11 from another machine after boot |