FAQ
Hi,
I have a remote server with PostgreSQL on it.
When I try to connect via python/pygresql, I get:

pg.InternalError: could not connect to server: Connection refused
Is the server running on host "##.##.##.###" and accepting
TCP/IP connections on port 5432?

Where I've blanked out my server's ip address for obvious reasons.

I ssh'd to my server and did this to iptables:

iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

restarted iptables, but still no dice.

Any advice?

Thanks in advance!
-Daniel

Search Discussions

  • John Meredith at Jun 30, 2011 at 7:34 am
    Hi,

    Is there any device between your postgreSQL server and PC, e.g. network
    router or firewall?

    Something else besides the iptables on your server can be blocking port
    5432. I'd also check that your PostgreSQL server hasn't been configured to
    listen on some other port.
    On 30 Jun 2011 08:11, "Daniel Weitzenfeld" wrote:
    Hi,
    I have a remote server with PostgreSQL on it.
    When I try to connect via python/pygresql, I get:

    pg.InternalError: could not connect to server: Connection refused
    Is the server running on host "##.##.##.###" and accepting
    TCP/IP connections on port 5432?

    Where I've blanked out my server's ip address for obvious reasons.

    I ssh'd to my server and did this to iptables:

    iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

    restarted iptables, but still no dice.

    Any advice?

    Thanks in advance!
    -Daniel
  • Michael Wood at Jun 30, 2011 at 11:05 am

    On 30 June 2011 04:07, Daniel Weitzenfeld wrote:
    Hi,
    I have a remote server with PostgreSQL on it.
    When I try to connect via python/pygresql, I get:

    pg.InternalError: could not connect to server: Connection refused
    Is the server running on host "##.##.##.###" and accepting
    TCP/IP connections on port 5432?

    Where I've blanked out my server's ip address for obvious reasons.

    I ssh'd to my server and did this to iptables:

    iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

    restarted iptables, but still no dice.

    Any advice?
    First answer the question you got when you tried to connect :) Is
    PostgreSQL listening on port 5432 on the external IP address you were
    trying to connect to?

    The chances are it was either not listening for TCP connections at
    all, or only on 127.0.0.1.

    Try running "netstat -tln | grep 5432" and see what you get.

    --
    Michael Wood <esiotrot@gmail.com>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJun 30, '11 at 2:08a
activeJun 30, '11 at 11:05a
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase