pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Jason Swails <jason.swails@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Cannot connect to postgresql-11 from another machine after boot
Date: Thu, 13 Feb 2020 21:02:04 -0800
Message-ID: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com> (raw)
In-Reply-To: <CAEk9e3pcmikJRo6cQ0COHpu_Z9gLLUeX=tY1w1qOVpzUehCB9A@mail.gmail.com>
References: <CAEk9e3pcmikJRo6cQ0COHpu_Z9gLLUeX=tY1w1qOVpzUehCB9A@mail.gmail.com>

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@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.

I would start by looking in the system log to see what it records when 
the service tries to start on reboot.

> 
> Thanks,
> Jason
> 
> -- 
> Jason M. Swails


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (7+ messages)  latest in thread

Message-ID: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com>
Permalink:  ../4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com/
Also on:    postgresql.org/message-id/4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, jason.swails@gmail.com
  Subject: Re: Cannot connect to postgresql-11 from another machine after boot
  In-Reply-To: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com>
  References: <CAEk9e3pcmikJRo6cQ0COHpu_Z9gLLUeX=tY1w1qOVpzUehCB9A@mail.gmail.com> <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox