Thread: Server doesn't seem to be listening...

Server doesn't seem to be listening...

From
"Eric D. Nielsen"
Date:
I recently resized a virtual machine hosting an instance of
PostGreSQL.  After the resize and the required reboot, PostGreSQL
seem to be acting a little odd.

As a local user, I can connect to my databases. but my Java
applications can now longer connect to the database.  (I get the
standard "org.postgresql.util.PSQLException: Connection refused.
Check that the hostname and port are correct and that the postmaster
is accepting TCP/IP connections."

I've confirmed from the commandline using
psql -h <hostname> -p <port> -U <username> database
"psql: could not connect to server: Connection refused
         Is the server running on host "<hostname>" and accepting
         TCP/IP connections on port <port>?
"

So I think its something I need to fix at the PG end of things.

Both Java and command line were occurring on the same host as the
server, and worked before the VM resize.  Just in case I tried
punching a hole in the firewall for  the port (wasn't needed before,
but just wanted to check that first), but it didn't make any difference.

The IP of the server didn't change as a result of the resize, so the
line in pg_hba.conf allowing this single account to connect is still
correct.

Now the thing I know I did wrong was that I didn't shut down the
postmaster before the resize brought the system down.  (Its test only
data, if its hosed, that's acceptable).  And I had to manually
restart the postmaster after the resize.  I didn't see any errors and
the startup scripts seemed to run successfully.

What else should I be looking at?

Thank you.
Eric


Re: Server doesn't seem to be listening...

From
Tom Lane
Date:
"Eric D. Nielsen" <nielsene@mit.edu> writes:
> I've confirmed from the commandline using
> psql -h <hostname> -p <port> -U <username> database
> "psql: could not connect to server: Connection refused

That's not a Postgres problem.  You do not have network-level
connectivity --- I'm betting you forgot to enable TCP access
to that VM, or something along that line.  Think firewall
configuration, not Postgres.

            regards, tom lane

Re: Server doesn't seem to be listening...

From
Eric D Nielsen
Date:
Quoting Tom Lane <tgl@sss.pgh.pa.us>:

> "Eric D. Nielsen" <nielsene@mit.edu> writes:
>> I've confirmed from the commandline using
>> psql -h <hostname> -p <port> -U <username> database
>> "psql: could not connect to server: Connection refused
>
> That's not a Postgres problem.  You do not have network-level
> connectivity --- I'm betting you forgot to enable TCP access
> to that VM, or something along that line.  Think firewall
> configuration, not Postgres.

I had already checked the firewall issues before posting.  What I
hadn't checked
was netstat, which showed that after the resize it was binding so that only
"localhost" could connect and not the domain name.  This is actually
better for
me.

Thank you for sending me back to the right place to look.

Eric