Обсуждение: Pgadmin access to Postgresql

Поиск
Список
Период
Сортировка

Pgadmin access to Postgresql

От
Luciano Martin Galletti
Дата:


i'm tryng to access to a db that is on a my server.

The port is 5432 open and accept tcp/ip connections.

Server doesn't listen
The server doesn't accept connections: the connection library reports 
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "IP_OF_THE_SERVER" and accepting TCP/IP connections on port 5432? 

Do i have to set something in pg_hba.conf
to have access at the database from outside and from internet and not intranet?

this is the pg_hba.conf


/etc/postgresql/9.3/main/pg_hba.conf

# Database administrative login by Unix domain socket
local all postgres $

# TYPE DATABASE USER ADDRESS $

# "local" is for Unix domain socket connections only
local all all $
# IPv4 local connections:
host all all 127.0.0.1/32 $
# IPv6 local connections:
host all all ::1/128 $
# Allow replication connections from localhost, by a user with$
# replication privilege.
#local replication postgres $
#host replication postgres 127.0.0.1/32 $

Re: Pgadmin access to Postgresql

От
Adrian Klaver
Дата:
On 07/09/2016 08:00 AM, Luciano Martin Galletti wrote:
>
> i'm tryng to access to a db that is on a my server.
>
> The port is 5432 open and accept tcp/ip connections.
>
> Server doesn't listen
> The server doesn't accept connections: the connection library reports
> could not connect to server: Connection refused (0x0000274D/10061) Is
> the server running on host "IP_OF_THE_SERVER" and accepting TCP/IP
> connections on port 5432?

Are you connecting over a network?

In other words is pgAdmin on one machine and the server on another?

If so is there a firewall in between that is blocking access to port 5432?

If not can you explain more about what your setup is?

>
> Do i have to set something in pg_hba.conf
> to have access at the database from outside and from internet and not
> intranet?
>
> this is the pg_hba.conf
>
>
> /etc/postgresql/9.3/main/pg_hba.conf
>
> # Database administrative login by Unix domain socket
> local all postgres $
>
> # TYPE DATABASE USER ADDRESS $
>
> # "local" is for Unix domain socket connections only
> local all all $
> # IPv4 local connections:
> host all all 127.0.0.1/32 <http://127.0.0.1/32> $
> # IPv6 local connections:
> host all all ::1/128 $
> # Allow replication connections from localhost, by a user with$
> # replication privilege.
> #local replication postgres $
> #host replication postgres 127.0.0.1/32 <http://127.0.0.1/32> $
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Pgadmin access to Postgresql

От
Tom Lane
Дата:
Luciano Martin Galletti <galletti77@hotmail.com> writes:
> The server doesn't accept connections: the connection library reports
> could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "IP_OF_THE_SERVER"
andaccepting TCP/IP connections on port 5432? 

> Do i have to set something in pg_hba.conf

Probably, because what you showed doesn't include any line permitting
external connections; but that's not your problem yet.  "Connection
refused" is a network-level error: your connection is never getting to the
Postgres server.  Double-check addresses, check network connectivity,
check firewall settings.  My first bet is you need to poke a hole in the
server machine's firewall --- see iptables or local equivalent.  Another
possibility is that the server's listen_addresses setting only tells it
to listen for local TCP connections not remote ones.  You typically want
listen_addresses set to "*" if you intend to allow remote connections.

When you start getting complaints phrased along the lines of "no
pg_hba.conf entry" then it'll be time to fix pg_hba.conf.

            regards, tom lane