Обсуждение: Problem with connection

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

Problem with connection

От
karen chau
Дата:
Hi Folks,
I'm having trouble with connection / remote connection.  I'm running Postgres on Solaris 10.

$ netstat -a |grep 5432
localhost.5432             *.*                0      0 49152      0 LISTEN
6002ae2ee98 stream-ord 6002af1d080 00000000 /tmp/.s.PGSQL.5432       

Works fine
$ psql -d director
Welcome to psql 8.1.19 (server 8.2.17), the PostgreSQL interactive terminal.

Does not work
$ psql -h phys-brmtso-2 -d director
psql: could not connect to server: Connection refused
        Is the server running on host "phys-brmtso-2" and accepting
        TCP/IP connections on port 5432?

I tried both md5 & trust.
phys-brmtso-2# tail -15 pg_hba.conf
# superuser. If you do not trust all your local users, use another
# authentication method.


# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
#host    all         all         127.0.0.1/32          trust
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               trust
# remote connetions:
host    all         all         10.195.1.0/24          md5


Re: Problem with connection

От
Ziggy Skalski
Дата:

On 13-06-19 04:13 PM, karen chau wrote:
Hi Folks,
I'm having trouble with connection / remote connection.  I'm running Postgres on Solaris 10.

$ netstat -a |grep 5432
localhost.5432             *.*                0      0 49152      0 LISTEN
6002ae2ee98 stream-ord 6002af1d080 00000000 /tmp/.s.PGSQL.5432       

Works fine
$ psql -d director
Welcome to psql 8.1.19 (server 8.2.17), the PostgreSQL interactive terminal.

Does not work
$ psql -h phys-brmtso-2 -d director
psql: could not connect to server: Connection refused
        Is the server running on host "phys-brmtso-2" and accepting
        TCP/IP connections on port 5432?

I tried both md5 & trust.
phys-brmtso-2# tail -15 pg_hba.conf
# superuser. If you do not trust all your local users, use another
# authentication method.


# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
#host    all         all         127.0.0.1/32          trust
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               trust
# remote connetions:
host    all         all         10.195.1.0/24          md5



Hi,

Check this line in your postgresql.conf maybe?

#listen_addresses = 'localhost'        # what IP address(es) to listen on;

You should have it set to localhost *and* the hostname you want to use (i.e. the phys-brmtso-2), that might be the problem I think.

Ziggy

Re: Problem with connection

От
Adrian Klaver
Дата:
On 06/19/2013 01:13 PM, karen chau wrote:
> Hi Folks,
> I'm having trouble with connection / remote connection.  I'm running
> Postgres on Solaris 10.
>
> $ netstat -a |grep 5432
> localhost.5432             *.*                0      0 49152      0 LISTEN
> 6002ae2ee98 stream-ord 6002af1d080 00000000 /tmp/.s.PGSQL.5432
>
> _Works fine_
> $ psql -d director
> Welcome to psql 8.1.19 (server 8.2.17), the PostgreSQL interactive terminal.
>
> _*Does not work*_
> $ psql -h phys-brmtso-2 -d director
> psql: could not connect to server: Connection refused
>          Is the server running on host "phys-brmtso-2" and accepting
>          TCP/IP connections on port 5432?
>

Are you connecting locally in both cases or across a network in the
second case?

If across a network, might there be a firewall in between blocking
connections?

--
Adrian Klaver
adrian.klaver@gmail.com


Re: Problem with connection

От
John R Pierce
Дата:
On 6/19/2013 1:53 PM, Ziggy Skalski wrote:
> #listen_addresses = 'localhost'        # what IP address(es) to listen on;
>
> You should have it set to localhost *and* the hostname you want to use
> (i.e. the phys-brmtso-2), that might be the problem I think.

or better,

listen_addresses = '*'     # listen to all network interfaces.


(note you have to remove the leading # as thats a comment).




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast