Hi Jason and Robert,

Unfortunately, I don't have the knowledge to write a patch for this so low level feature, and I don't even saw a line of couchdb code, yet. I could give hints to someone who knows very well the sockets, if needed.

I'm just a mere new (6 months) user of/developer on couchdb. I also have a good experience in configuring all types of server, and I was surprise for the first time that I couldn't choose the interfaces/ip on witch the server listens. (just for the record, I tried it when I realise the /etc/hosts file of ubuntu defines by default the machine hostname on 127.0.1.1 (not 127.0.0.1) so couchdb was not responding on it, and I wanted it to bind to both of them, but not on external addresses. So I looked how to define several address, and I found this old post, and this (open) couchdb https://issues.apache.org/jira/browse/COUCHDB-907 ticket, saying we can't, and I wrote to say it is really a pitty.

Use case of different ports/ips can be on big servers having several network interfaces (or simply several IPs on one interface), and want to listen to two of them (e.g. one for internal, one for external traffic, but not all of them).

This said, I don't have a clue if this is as easy as adding a bit of configuration parsing and a for loop to the bind function, or if managing several sockets instead of one makes everything much more complex. One may also contest that nowadays, with cloud, virtual computers, and the good replication system of couchdb allowing several instances for the same content, these situations maybe cancelled by some workaround. But as always, this adds complexity which would be handy (from user's/administrator's point of view) to avoid by just modifying a configuration file (or even with some PUT http request, with the server restarting by itself, this is a killing feature of couchdb, I admit!)

To answer Jason's question, in general, there are two ways of defining the bind address and port :

- two separated options, like couchdb now, but that may have multiple values.
So
Address : 127.0.0.1; 192.168.0.1; 10.1.1.0/24
Port: 80 5984
Would listen to all combinations

- on single option with both
bind_address : 0.0.0.0:5984; 127.0.0.1:123; 127.0.0.1:234;

The first option seems the easiest to do, and is still compatible with the actual couchdb configuration. Although, we may accept a mix of them : if the bind_address entry defines a port, then listen to it, and not on the ports list in the port option. It seems still quite easily understandable to whom configures it.

So your example may become :

bind_address : 0.0.0.0:5984 127.0.0.1:80 1.2.3.4 2.4.6.8 4.6.8.19
port : 123 234 456

I add that although couchdb seems to be able to bind on ip6, the actual configuration makes it so that we can't bind to both ip4 and ip6 at the same time, because this requires at least 2 bind_address entries (0.0.0.0 and ::). Except there is a way I didn't (I tried *, but that won't do it)

My two cents, hope this helps, I'm available for other input, if needed,

Franck

On 08/09/2013 15:58, Jason Smith wrote:
Franck, how would you envision the config working for multiple IPs and
ports to bind to?

Currently they are two different configuration options, so I am trying to
understand how it would work in the general case.

For example if I want to listen to 0.0.0.0:5984 but then 127.0.0.1:80 and
then 1.2.3.4, 2.4.6.8, and 4.6.8.16 for each of ports 123, 234, 456. For
that scenario (which I think represents the most complex/flexible support
Couch could conceivably offer), how would the configuration for that look
to you?


On Sun, Sep 8, 2013 at 7:46 PM, Franck Eyraud <[email protected]>wrote:

Paul Davis <paul.joseph.davis@...> writes:

On Wed, Mar 24, 2010 at 3:28 PM, Cairo Noleto <caironoleto@...> wrote:
Hi, how to set bind address for a five unique IPs? ("bind_address =
192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 192.168.1.5")

--
Cairo Noleto 
Visits http://www.caironoleto.com/

Cairo,

You can't. If you need to have a subset of your public IP's used then
you'll need to setup a proxy. CouchDB  only natively supports a single
interface, with the special case that 0.0.0.0 means all interfaces.

I don't think it'd be out of the question to support a multiple
listener sockets but no one has been motivated to create a patch so
there's never really been any discussion on it.
Hi,

I think this is in fact a *very* important missing feature for couchdb to
be
accepted in big IT infrastructures, as well as bind on several ports...

Regards,

Franck Eyraud




Reply via email to