Improve ListenAddress in Storage-Conf

Details

Type: Improvement

Status:Resolved

Priority: Minor

Resolution:
Invalid

Fix Version/s:
None

Component/s:
None

Labels:

None

Description

Right now in storage-conf we have:

<ListenAddress>localhost</ListenAddress>

We should probably change this to 0.0.0.0 by default for new comers, since setting up multi-node installation with localhost, isn't going to work right. Right now 0.0.0.0 might not work right, (leaving blank does). So we should check that in DatabaseDescriptor. Also a nice to have is maybe an XML doc comment.

Activity

The reason it defaults to localhost is that letting the JDK pick an address (which is what it does when it is left blank) does not always work. We want a default that will always work at least in the single node case.

Using 0.0.0.0 to mean "pick one" is confusing to someone who understands what is going on. This value is the one that it tells other nodes connect to. Another node cannot connect to 0.0.0.0 so it does not make sense.

We do need to document the blank=guess option. But again, I emphasize that it's not magic and it DOES pick the wrong one sometimes. This screwed a lot of people over in the early days, it's not just a hypothetical problem.

Jonathan Ellis
added a comment - 25/Jun/09 03:56 The reason it defaults to localhost is that letting the JDK pick an address (which is what it does when it is left blank) does not always work. We want a default that will always work at least in the single node case.
Using 0.0.0.0 to mean "pick one" is confusing to someone who understands what is going on. This value is the one that it tells other nodes connect to . Another node cannot connect to 0.0.0.0 so it does not make sense.
We do need to document the blank=guess option. But again, I emphasize that it's not magic and it DOES pick the wrong one sometimes. This screwed a lot of people over in the early days, it's not just a hypothetical problem.

0.0.0.0 is synonymous for "any", the expectation would be that cassandra will respond on "any" of the node's addresses, (that it is bound to all of them). That is definitely not going to work.

Leaving it blank essentially leaves it up to InetAddress.getLocalHost(). This will always do the Right Thing if the node is properly configured (hostname, name resolution, etc), and the Right Thing is to use the address associated with the hostname (it might not be).

Eric Evans
added a comment - 25/Jun/09 15:56 0.0.0.0 is synonymous for "any", the expectation would be that cassandra will respond on "any" of the node's addresses, (that it is bound to all of them). That is definitely not going to work.
Leaving it blank essentially leaves it up to InetAddress.getLocalHost(). This will always do the Right Thing if the node is properly configured (hostname, name resolution, etc), and the Right Thing is to use the address associated with the hostname (it might not be).