Обсуждение: Connection Issue
I cannot connect to a postgres (8.3) cluster locally (via ssh onto the server).
The postgresql.conf file has this:
# - Connection Settings -
listen_addresses = '*'
#listen_addresses = '0.0.0.0' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You might
# also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directory = '/var/run/postgresql' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)
The pg_hba.conf has this:
local all postgres trust
local all postgres ident sameuser
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident sameuser
# IPv4 local connections:
host all postgres 127.0.0.1/32 trust
host all all 127.0.0.1/32 md5
hostssl all all 0.0.0.0/0 md5
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
I can ssh to a different host and connect via psql -h <host>
but if I'm on the postgres local server I get this:
$ psql -l
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Thoughts?
Thanks in advance
Hi, On Fri, Jun 12, 2009 at 12:19 PM, Kevin Kempter<kevink@consistentstate.com> wrote: > unix_socket_directory = '/var/run/postgresql' # (change requires restart) <snip> > I can ssh to a different host and connect via psql -h <host> > > but if I'm on the postgres local server I get this: > > $ psql -l > psql: could not connect to server: No such file or directory > Is the server running locally and accepting > connections on Unix domain socket "/tmp/.s.PGSQL.5432"? > > > Thoughts? You need to specify the directory of unix-domain socket as follows. $ psql -h /var/run/postgresql -l HTH Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center