Home > Archive > PostgreSQL Administration > June 2005 > listening on tcp socket instead of unix domain









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author listening on tcp socket instead of unix domain
David Bear

2005-06-25, 1:23 pm

Hoping to get postgresql to listen on a tcp socket I made the
following change to postgresql.conf:

#listen_addresses = 'localhost' # what IP interface(s) to listen on;
listen_addresses = 'localhost' # what IP interface(s) to listen on;
# defaults to localhost, '*' = any
#port = 5432
port = 5432

I understand this to mean, listen on localhost, ie 127.0.0.1.

However, a netstat -l tells me:

netstat -l | grep 5432
unix 2 [ ACC ] STREAM LISTENING 732094 /tmp/.s.PGSQL.5432

netstat -l | grep postg
tcp 0 0 localhost:postgresql
*:* LISTEN
tcp 0 0 localhost:postgresql
*:* LISTEN

This doesn't look right. Moreover, when attempting to create an ssh
tunnel to connect to postgres from a windows box, the connection
fails.

Is postgres really listening on a socket that is 'connect-able'
through ssh tunneling? If so, then would using ssh command

ssh -L 5432:remotehost:5432
user@remotehost

be sufficient to connect to the postgres running on remote host? This
fails when running psql on the machine with message:

> psql -p 5432

psql: could not connect to server: No such file or directory
....

So, I don't think something is quite working. Please advise.

--
David Bear
phone: 480-965-8257
fax: 480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
"Beware the IP portfolio, everyone will be suspect of trespassing"

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org

Tom Lane

2005-06-25, 8:23 pm

David Bear <David.Bear@asu.edu> writes:
> However, a netstat -l tells me:


> netstat -l | grep 5432
> unix 2 [ ACC ] STREAM LISTENING 732094 /tmp/.s.PGSQL.5432


> netstat -l | grep postg
> tcp 0 0 localhost:postgresql
*:* LISTEN
> tcp 0 0 localhost:postgresql
*:* LISTEN


> This doesn't look right.


It looks fine to me. The reason there are two listening sockets is most
likely that one is IPv4 and the other is IPv6 --- netstat's default display
fails to distinguish this (at least on Linux), but you can see it if you
do "netstat -l -n".

> Moreover, when attempting to create an ssh tunnel to connect to
> postgres from a windows box, the connection fails.


You're going to have to give more detail (like exactly what you tried
and exactly what happened) if you want help with that. It could be a
firewall issue, but that's strictly a guess.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com