Discussion:
Solutions for listening on multiple ports?
Jason L. Buberel
2007-10-09 16:22:27 UTC
Permalink
Is there a 'generally accepted' best practice for enabling a single
postgres instance to listen for client connections on more than one
ip/port combination?

As far as I can tell, the 'listen_address' and 'port' configuration
variables can only accommodate single values:

listen_address = 127.0.0.1
port = 5432

What I would like to simulate is Apache's notation:

Listen: 127.0.0.1:5432
Listen: 192.168.0.1:54824
...

The force behind this is network security policies and such. I would
prefer to not resort to kernel-level netfilter trickery to accomplish
this, if possible.

Thanks,
Jason
Erik Jones
2007-10-09 16:35:09 UTC
Permalink
Post by Jason L. Buberel
Is there a 'generally accepted' best practice for enabling a single
postgres instance to listen for client connections on more than one
ip/port combination?
As far as I can tell, the 'listen_address' and 'port' configuration
listen_address = 127.0.0.1
port = 5432
Listen: 127.0.0.1:5432
Listen: 192.168.0.1:54824
...
The force behind this is network security policies and such. I
would prefer to not resort to kernel-level netfilter trickery to
accomplish this, if possible.
You can separate listen addresses with commas:

listen_address = '127.0.0.1,192.168.0.1'

AFAIK, you only get one port per cluster.

Erik Jones

Software Developer | Emma®
***@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq
Scott Marlowe
2007-10-09 17:12:53 UTC
Permalink
Post by Jason L. Buberel
Is there a 'generally accepted' best practice for enabling a single
postgres instance to listen for client connections on more than one ip/port
combination?
As far as I can tell, the 'listen_address' and 'port' configuration
listen_address = 127.0.0.1
port = 5432
As mentioned by someone else, you can have > 1 IP be listended to, but
only the one port. You could likely use port forwarding to accomplish
having pgsql listen on > 1 port. In linux you'd do this with
iptables.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly

Continue reading on narkive:
Loading...