Closed inqueue closed 9 years ago
I should note this configuration is not any different than versions prior to 2.x. The difference is Elasticsearch no longer binds to all interfaces by default which can be very unexpected if going to 2.0 from an upgrade for example. See Breaking Changes in 2.0 for more details on the change.
A note regarding IPv6 address syntax would be helpful, too.
To bind to all IPv6/IPv4 addresses, you can use
network.bind_host: "0"
network.bind_host: "::"
To bind to IPv4 loopback (localhost) only, you can use
network.bind_host: "0.0.0.0"
together with JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses"
To bind to IPv6 loopback (localhost) only, you can use
network.bind_host: "::1"
Thank you @jprante for your contributions.
To bind to IPv4 loopback (localhost) only, you can use
network.bind_host: "0.0.0.0"
In my observations, this binds to all IPv6/IPv4 just like network.bind_host: 0
:
bash-3.2$ uname -a
Darwin peanut.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
bash-3.2$ grep bind_host elasticsearch.yml
network.bind_host: "0.0.0.0"
bash-3.2$ netstat -p tcp -tna | egrep "(9200|9300).*LISTEN"
tcp46 0 0 *.9200 *.* LISTEN
tcp46 0 0 *.9300 *.* LISTEN
bash-3.2$ curl -I http://192.168.5.120:9200
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
bash-3.2$ curl -I http://[fe80::a299:9bff:fe11:5f69%en0]:9200
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
bash-3.2$ curl -I http://127.0.0.1:9200
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
bash-3.2$ curl -I http://[::1]:9200
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
You must set JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses"
to ES start script to disable IPv6, then network.bind_host: "0.0.0.0"
is IPv4 only (and all IPv6 networking will give java.net.SocketException: Protocol family unavailable
)
Ah, just as you mentioned in your previous comment @jprante. Thanks!
+1 on this, be great to provide more clarification for users.
Moving this issue to the elasticsearch repo
This issue was moved to elastic/elasticsearch#14607
Can we add documentation to Network Settings that illustrates how to configure binding Elasticsearch to all network interfaces; i.e., using a wildcard?
elasticsearch.yml:
All interfaces are listening:
We do not want to necessarily encourage this configuration, however, it would be very helpful to document how to do it.
As a side note, configuring
network.bind_host: 0.0.0.0
or0.0.0
or0.0
also works which is just unexpected. It seems just documenting a lone0
value would suffice.