Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3KKg-0006XO-4O for pgsql-general@arkaria.postgresql.org; Sun, 16 Feb 2020 13:51:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3KKd-0000kF-VA for pgsql-general@arkaria.postgresql.org; Sun, 16 Feb 2020 13:51:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3KKc-0000hD-Sg for pgsql-general@lists.postgresql.org; Sun, 16 Feb 2020 13:51:35 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j3KKS-0002VV-Ud for pgsql-general@lists.postgresql.org; Sun, 16 Feb 2020 13:51:32 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 7C0D7245C; Sun, 16 Feb 2020 14:51:21 +0100 (CET) Date: Sun, 16 Feb 2020 14:51:21 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Cannot connect to postgresql-11 from another machine after boot Message-ID: <20200216135121.GA10553@hjp.at> References: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-02-13 21:03:48 -0800, Adrian Klaver wrote: > On 2/13/20 9:02 PM, Adrian Klaver wrote: > > On 2/13/20 7:54 PM, Jason Swails wrote: > > > The problem is that after my machine boots, I'm unable to connect to > > > the server from anywhere except localhost.=A0 Running a simple > > > "systemctl restart postgresql" fixes the problem and allows me to > > > connect from anywhere on my LAN.=A0 Here is an example of this > > > behavior: [...] > > >=20 > > > So the first connection attempt fails.=A0 But when I restart the > > > service and try again (doing nothing else in between), the > > > connection attempt succeeds.=A0 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. > > >=20 > > > Any ideas how to start hunting down the root cause?=A0 I think this > > > started happening after I moved the data directory to another drive. > >=20 > > I would start by looking in the system log to see what it records when > > the service tries to start on reboot. >=20 > Hit send to soon. At a guess the Postgres service is starting before the > drive is mounted. I don't think this has anything to do with the drive. If the drive wasn't mounted he couldn't connect from localhost either. What is probably happening is that postgresql is configured to listen on localhost and the IP address of the ethernet interface and is starting before the etherned interface is ready. So it is listening only on localhost (there should be an error message regarding the other address in the log). When he restarts postgresql some time later, the interface is ready. It should be possible to solve this by adding the right dependencies to sys= temd.=20 hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl5JSNUACgkQ8g5IURL+ KF1Dgg/+OwzWfGZQQ1HaELYq8dvK0kV2/rIgIjGv1ANmpVR1IgC9od03wBvYERUr vj9Zk1GrYZO7ZnhPo5xA0+zlUf1MqVoVwvWmGi9FdCsGtfW905cMnMt5woLrU7id +TvKX4NZOZry601f7ymPKrTs04/DS3CS8QBHL3w26RX8BXh5EMeKFFRkyxHU+7At hNqlqn/+mzXS99K5+Oy05C5OrOxOgLis64er4oNNqdaHUZWL0eii6UcTCJ4emg9V rNx01Yarod5BgetrAOm6qDWAwYpfnzvJ2VzGgmU4PN7kMBtuP2LaFOSxbiLUvGiT ced0YcPpo0lq7B0/VtLsScoQ1pQGfqexrxDXcbYI8g1qSIOD5HZt5j3nBlWpKecD alj4TJKIL9LioCLvGsIooqjVBq2VLxH+TPXDgWXScz07N5gp8YGVyJ+UnENHJAnP Bzzi4TUmb+4sZBF7kN9LH5f3KPjwf9zUlj27udDP7jyqqWzYf77mQxMZjUznPW+b nEDoSFQi6n4tnni9eAICEhqt7OsaFrruY9eBJbPIga5Av9odHZT8a7ilsymo5lDs 2eGLVA5fk6iq+DTM6RoGNYFpR67qJYLandWHBT2sHpOMVNGlw3Wa+obA0W+mPwyN rgoXy9cSL/2nLYlKvbrgBrAxh6dsVJ/ePOVOKOwO2+BJfqqKn1g= =slmG -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C--