码迷,mamicode.com
首页 > 其他好文 > 详细

kafka binding to ipv6 port even though ipv4 address specified in config

时间:2021-06-02 12:29:05      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:ESS   cell   ram   and   app   mac   linu   HERE   comment   

I am in a bit of a bind (pun intended).

I have a ubuntu server running kafka & zookeeper. This server has both ipv4 and ipv6 protocols installed.

In the server.properties file, I specified the host.name and advertised.host.name as my public ipv4 address.

When I start zookeeper and kafka, kafka still binds to ipv6 port.

$ netstat -l -t | grep 9092 
tcp6       0      0 ferozed-linux3.mydomain:9092 [::]:*                  LISTEN

The client machine from which I am running a producer in a MapReduce job, is an IPv4 machine. Due to the fact that the server is binding to an IPv6 interface, the client is unable to connect to it.

Any idea how I can fix this?

3 Answers

10
 

Starting from Andrey‘s answer, you can solve it just by adding an environment variable

export KAFKA_OPTS="-Djava.net.preferIPv4Stack=True"
 
 

If I understand you correctly, you need the following:

System.setProperty ("java.net.preferIPv4Stack", "true");

in the code, or

-Djava.net.preferIPv4Stack = True

in the web server startup script worked.

Did you try it?

 

Add this is kafka/bin/Kafka-run-class.sh

KAFKA_OPTS="-Djava.net.preferIPv4Stack=True"

And restart Kafka broker.

kafka binding to ipv6 port even though ipv4 address specified in config

标签:ESS   cell   ram   and   app   mac   linu   HERE   comment   

原文地址:https://www.cnblogs.com/felixzh/p/14816404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!