Elasticsearch version:
2.2.0
JVM version:
Oracle JDK 1.8.0_66
OS version:
CentOS 6.7
Description of the problem including expected versus actual behavior:
Expected behavior: setting network.host to 0.0.0.0, or _non_loopback:ipv4_ should bind to and communicate via IPv4.
Actual behavior: ES binds to the IPv4 ports, but still communicates via IPv6.
tcp 0 0 ::ffff:10.103.0.52:58988 ::ffff:10.103.0.118:9300 ESTABLISHED 498 655379 11143/java
tcp 0 0 ::ffff:10.103.0.52:53290 ::ffff:10.100.21.70:9300 ESTABLISHED 498 655287 11143/java
tcp 0 0 ::ffff:10.103.0.52:17736 ::ffff:10.100.21.48:9300 ESTABLISHED 498 655216 11143/java
tcp 0 0 ::ffff:10.103.0.52:9300 ::ffff:10.100.21.25:39772 ESTABLISHED 498 655531 11143/java
Steps to reproduce:
master = true
)Provide logs (if relevant):
I haven't found any relevant logs
its not a bug: this is how java works. it uses ipv4 mapped addresses and so on.
If you bind to 0.0.0.0 its the same as binding to ::1
Well that sucks. :/ Thanks.
@ntent-ashton you can use the :ipv4
and :ipv6
modifiers with the "special values" listed here: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values
Is there any solution for this issue? Still I'm struggling to find out way to bind the port only to IPv4 address.
[root@b04d2 ~]# netstat -anlp | grep 9200
tcp 0 0 ::ffff:10.207.98.10:9200 :::* LISTEN 32756/java
Please advise, I appreciate your help.
Thanks
Sankar
@Sankardunga Start the JVM with -Djava.net.preferIPv4Stack=true
(via ES_JAVA_OPTS
). If you have additional questions, please open a topic on the Elastic Discourse forum.
Ya, got it. Thank you.
Setting this environment variable (via ES_JAVA_OPTS) saved my nuts!
-Djava.net.preferIPv4Stack=true
I was trying to get a elasticsearch 5.5 docker image working in Heroku and it was always trying to bind to a ipv6 bound_address. This would result in the following error:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
After setting this value it forced ipv4 and solved my problems!
Most helpful comment
@Sankardunga Start the JVM with
-Djava.net.preferIPv4Stack=true
(viaES_JAVA_OPTS
). If you have additional questions, please open a topic on the Elastic Discourse forum.