服务器启动时为什么服务器因“java.net.SocketException:invalid argument”而失败?

时间:2013-08-07 09:04:28

标签: apache-kafka

卡夫卡 0.8

我按照快速入门指南操作,当我来到第2步运行bin/kafka-server-start.sh config/server.properties时,我面临异常:

[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)

我可能做错了什么?请指教。

1 个答案:

答案 0 :(得分:3)

可能是名称解析问题,或者是0.7的剩余设置。

如果您要从0.7迁移,请参阅migration guide

如果您刚刚开始,请确保/ etc / hosts中有一个准确的条目作为您的主机名。

e.g。给出带有

/etc/hostname文件
yourhostname

和一个接口(/sbin/ifconfig)使用示例IP 10.181.11.14

进行监听

/ etc / hosts应该正确地将该名称映射到监听界面:

10.181.11.14    yourhostname.yourdomain.com       yourhostname   someotheralias

您可以通过telnet到kafka端口进行测试,并确保没有超时:

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