TCP only listening on localhost??? - Mailing list pgsql-general

From Richard Gass
Subject TCP only listening on localhost???
Date
Msg-id 49D9473417F1234C9C86886EE8353FAAE9C1F0@mailman.sprintlabs.com
Whole thread Raw
Responses Re: TCP only listening on localhost???
List pgsql-general
First weird problem...
The other day, out of the blue, our application reported an error saying it
could not connect to the postgres db.  The hostname that it reported is the
name of the machine but it hasn't been used in awhile.  However, it does
have a valid cname entry in dns pointing to the correct host.  I added the
name in the /etc/hosts file on the server and the problem was fixed.

Next weird problem...
I recently upgraded a few nodes that connect to the server to Redhat 9.  I
installed all the necessary rpm's and when I tried to connect to the remote
server, I get the following error.

# psql -U postgres -d dbname -h server_name
psql: could not connect to server: Connection refused
        Is the server running on host server_name and accepting
        TCP/IP connections on port 5432?

Here is the output of netstat -ae | grep tcp | grep LIST

...
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN

tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN

...

As you can see, postgres is listening on localhost put not "0.0.0.0:5432" as
I see in many posts to this site.  This was working fine before but now I
cannot connect from any other server that I have given permission to in
pg_hba.conf.
local   all         all                                             trust
host    all         all         127.0.0.1         255.255.255.255   trust
host    all         all         10.64.228.10      255.255.255.255   trust
host    all         all         10.64.228.112     255.255.255.255   trust
host    all         all         10.64.228.115     255.255.255.255   trust

And Yes I have the "-i" option specified in my postmaster command...
/usr/local/db/pgsql/bin/postmaster -i -c log_connections=on -h server_name
-D /usr/local/db/pgsql/data

and Yes I have tcpip_socket = true in postgresql.conf.

No, I do not have multiple installs of postgres on this system and I am sure
they are using the correct configuration files.

This was all working fine until I recently.  It has been a long time since I
have restarted the server (  5:05pm  up 377 days, 18:36,  7 users,  load
average: 0.00, 0.00, 0.00) and it has been a long time since I restarted the
postgres DB.  I wonder if some weirdness is happening which isn't allowing
postgres to bind to tcp port 5432.

From the server...  This is connecting through the socket...
# psql -h server_name -U postgres -d dbname
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

dbname=# \q
From the server...  This is trying to connect to the port...
# psql -h 10.64.228.10 -U postgres -d dbname
psql: could not connect to server: Connection refused
        Is the server running on host 10.64.228.10 and accepting
        TCP/IP connections on port 5432?

Any ideas what could be happening?

Thanks

Richard


pgsql-general by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Re: Plpgsql problem passing ROWTYPE to function
Next
From: Tom Lane
Date:
Subject: Re: Optimizer choosing smaller index instead of right one