Re: postgres 9.0 - unable to bind to localhost.

From: "Gunnar \"Nick\" Bluth" <gunnar(dot)bluth(at)pro-open(dot)de>
To: Strahinja Kustudić <strahinjak(at)nordeus(dot)com>
Cc: "Rajagopalan, Jayashree" <Jayashree(dot)Rajagopalan(at)emc(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgres 9.0 - unable to bind to localhost.
Date: 2013-01-30 21:19:05
Message-ID: 51098E49.9020701@pro-open.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Am 23.12.2012 12:38, schrieb Strahinja Kustudić:
> Sorry for a late reply, but I had the exact same problem and it was a
> bug in the Red Hat RPM package upgrade script of the sudo package.
> This basically means the user running Postgres cannot resolve hostname
> localhost. Have you tried logging in as the user running Postgres and
> trying to resolve localhost? In RHEL/Centos you would do this with:
>
> *su - postgres*
> *nslookup localhost*
>

A late comment on this one... but I've learnt this lesson the hard way :/
If you want to know what am actual program will get, use "getent hosts
<hostname/IP>", that will follow the directions in nsswitch.conf and
also use an nscd, if you're running one.

So, if someone (for whatever reason) once put a line
1.2.3.4 localhost
in your /etc/hosts, the "nslookup" will return what you'd expect (i.e.,
hopefully ;-), but Postgres will try to open a socket on 1.2.3.4. Bang!

Apart from that:
a) nslookup is deprecated since ages, use "host" or "dig" (well, no, use
"getent hosts" ;-)
b) I doubt that all DNS possible servers (M$ ones spring to mind...)
will provide answers to "localhost"

Just my 2p...

--
Gunnar "Nick" Bluth
RHCE/SCLA

Mobil +49 172 8853339
Email: gunnar(dot)bluth(at)pro-open(dot)de
__________________________________________________________________________
In 1984 mainstream users were choosing VMS over UNIX. Ten years later
they are choosing Windows over UNIX. What part of that message aren't you
getting? - Tom Payne

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Marko Rihtar 2013-02-01 09:43:32 Avoid casting NULLs in UNION...
Previous Message Albe Laurenz 2013-01-30 08:08:28 Re: PGSQL-IDLE connection problem