4

卡夫卡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)

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

4

1 回答 1

3

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

如果您从 0.7 迁移,请参阅迁移指南

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

例如给定一个/etc/hostname文件

yourhostname

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

/etc/hosts 应该将该名称正确映射到侦听接口:

10.181.11.14    yourhostname.yourdomain.com       yourhostname   someotheralias

您可以通过远程登录到 kafka 端口并确保没有超时来测试它:

telnet yourhostname.yourdomain.com 9092
Trying 10.181.11.14...
Connected to yourhostname.yourdomain.com.
Escape character is '^]'.
于 2014-02-04T19:50:06.727 回答