Why does the server crash with "java.net.SocketException: invalid argument" when starting the server?

Kafka 0.8

I follow the quick start guide, and when I go to step 2 to run bin/kafka-server-start.sh config/server.properties , I encounter an exception:

 [2013-08-06 09:55:14,603] INFO 0 successfully elected as leader (kafka.server.ZookeeperLeaderElector) [2013-08-06 09:55:14,657] ERROR Error while electing or becoming leader on broker 0 (kafka.server.ZookeeperLeaderElector) java.net.SocketException: invalid argument at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Net.java:465) at sun.nio.ch.Net.connect(Net.java:457) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:639) at kafka.network.BlockingChannel.connect(BlockingChannel.scala:57) at kafka.controller.ControllerChannelManager.kafka$controller$ControllerChannelManager$$addNewBroker(ControllerChannelManager.scala:84) at kafka.controller.ControllerChannelManager$$anonfun$1.apply(ControllerChannelManager.scala:35) at kafka.controller.ControllerChannelManager$$anonfun$1.apply(ControllerChannelManager.scala:35) at scala.collection.immutable.Set$Set1.foreach(Set.scala:81) at kafka.controller.ControllerChannelManager.<init>(ControllerChannelManager.scala:35) at kafka.controller.KafkaController.startChannelManager(KafkaController.scala:503) at kafka.controller.KafkaController.initializeControllerContext(KafkaController.scala:467) at kafka.controller.KafkaController.onControllerFailover(KafkaController.scala:215) at kafka.controller.KafkaController$$anonfun$1.apply$mcV$sp(KafkaController.scala:89) at kafka.server.ZookeeperLeaderElector.elect(ZookeeperLeaderElector.scala:53) at kafka.server.ZookeeperLeaderElector$LeaderChangeListener.handleDataDeleted(ZookeeperLeaderElector.scala:106) at org.I0Itec.zkclient.ZkClient$6.run(ZkClient.java:549) at org.I0Itec.zkclient.ZkEventThread.run(ZkEventThread.java:71) 

What can i do wrong? Please inform.

+4
source share
1 answer

This is probably either a problem with name resolution, or with other settings from 0.7.

If you are moving from 0.7, see the migration guide .

If you are starting fresh, make sure that / etc / hosts has an exact entry for your hostname.

eg. using the /etc/hostname file with

 yourhostname 

and an interface ( /sbin/ifconfig ) listening on the IP example 10.181.11.14

/ etc / hosts should correctly map this name to the listening interface:

 10.181.11.14 yourhostname.yourdomain.com yourhostname someotheralias 

You can verify this by telnetting to the kafka port and make sure there is no timeout:

 telnet yourhostname.yourdomain.com 9092 Trying 10.181.11.14... Connected to yourhostname.yourdomain.com. Escape character is '^]'. 
+3
source

Source: https://habr.com/ru/post/1495699/


All Articles