Re: could not connect to server: Connection refused (0x0000274D/10061)

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Anuj Pankaj <anujp(at)cybage(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: could not connect to server: Connection refused (0x0000274D/10061)
Date: 2010-09-30 23:38:21
Message-ID: 4CA51F6D.7020609@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Anuj Pankaj wrote:
>
> I installed Postgres 8.1.4 on Linux and postgres server is running and
> I successfully created database on local machine.
>
> I modified listen_addresses = '*' in Postgresql.conf and however If I
> try to access postgres through pgAdmin III. I am sticking with an
> exception.
>
>
>
> Exception is:
>
> could not connect to server: Connection refused (0x0000274D/10061) Is
> the server running on host "192.168.9.126" and accepting TCP/IP
> connections on port 5432?
>

My guess is that you have the iptables firewall running on this server,
and it doesn't allow remote users to connect to port 5432 on this
server. This is usually the case in a default RedHat/CentOS Linux
system for example. On that distribution, if you run
system-config-securitylevel as root you'll get to a text interface to
change settings around. Go into the "Customize" section, and add
"postgres:tcp" to the "Other ports" section. Running "service iptables
restart" afterwards will make the change active.

On other distributions, you can usually confirm whether this is the
problem by running (again as root) "iptables -L". If you see any
"(policy REJECT)" in there, and there isn't also a reference to the
postgres port on the list of what is accepted, you'll need to find the
firewall reconfiguration tool.

It is possible there's a firewall somewhere else between the server and
your system causing the problem instead, but from the fact that you're
using the 192.168.*.* block I'd assume your client and the server are on
the same local LAN.

--
Greg Smith, 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us
Author, "PostgreSQL 9.0 High Performance" Pre-ordering at:
https://www.packtpub.com/postgresql-9-0-high-performance/book

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tena Sakai 2010-10-01 04:06:51 <no subject>
Previous Message Guillaume Lelarge 2010-09-30 17:11:55 Re: pg_dumpall blocking other sessions