我几天前试图在没有Docker的情况下运行Kafka,我再次失败了。设置起来非常困难。所以,我决定使用Docker,然后我又失败了。可能是什么问题?
我运行了这些命令:
git clone https://github.com/confluentinc/cp-docker-images
cd cp-docker-images/examples/kafka-single-node
docker-compose up
顺便说一下,这是我的:
我下载了新的Docker for OS X here。
SIDE注意: OS X的新Docker使用与之前版本不同的架构,因此解决了使用Docker在OS X中遇到的许多问题。因此,我相信,Confluent Docker文档中讨论的大多数问题都会更容易解决。
错误日志:
kafka_1 | [2017-05-08 21:00:37,382] WARN [Controller-1-to-broker-1-send-thread], Controller 1 epoch 1 fails to send request (type: UpdateMetadataRequest=, controllerId=1, controllerEpoch=1, partitionStates={}, liveBrokers=(id=1, endPoints=(host=localhost, port=29092, listenerName=ListenerName(PLAINTEXT), securityProtocol=PLAINTEXT), rack=null)) to broker localhost:29092 (id: 1 rack: null). Reconnecting to broker. (kafka.controller.RequestSendThread)
kafka_1 | java.io.IOException: Connection to 1 was disconnected before the response was read
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1$$anonfun$apply$1.apply(NetworkClientBlockingOps.scala:114)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1$$anonfun$apply$1.apply(NetworkClientBlockingOps.scala:112)
kafka_1 | at scala.Option.foreach(Option.scala:257)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1.apply(NetworkClientBlockingOps.scala:112)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1.apply(NetworkClientBlockingOps.scala:108)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.recursivePoll$1(NetworkClientBlockingOps.scala:136)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.kafka$utils$NetworkClientBlockingOps$$pollContinuously$extension(NetworkClientBlockingOps.scala:142)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.blockingSendAndReceive$extension(NetworkClientBlockingOps.scala:108)
kafka_1 | at kafka.controller.RequestSendThread.liftedTree1$1(ControllerChannelManager.scala:196)
kafka_1 | at kafka.controller.RequestSendThread.doWork(ControllerChannelManager.scala:188)
kafka_1 | at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
kafka_1 | [2017-05-08 21:00:37,484] INFO [Controller-1-to-broker-1-send-thread], Controller 1 connected to localhost:29092 (id: 1 rack: null) for sending state change requests (kafka.controller.RequestSendThread)
kafka_1 | [2017-05-08 21:00:37,486] ERROR Processor got uncaught exception. (kafka.network.Processor)
kafka_1 | java.lang.NoClassDefFoundError: Could not initialize class kafka.network.RequestChannel$
kafka_1 | at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:111)
kafka_1 | at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:513)
kafka_1 | at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:505)
kafka_1 | at scala.collection.Iterator$class.foreach(Iterator.scala:893)
kafka_1 | at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
kafka_1 | at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
kafka_1 | at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
kafka_1 | at kafka.network.Processor.processCompletedReceives(SocketServer.scala:505)
kafka_1 | at kafka.network.Processor.run(SocketServer.scala:433)
kafka_1 | at java.lang.Thread.run(Thread.java:745)
kafka_1 | [2017-05-08 21:01:07,516] WARN [Controller-1-to-broker-1-send-thread], Controller 1 epoch 1 fails to send request (type: UpdateMetadataRequest=, controllerId=1, controllerEpoch=1, partitionStates={}, liveBrokers=(id=1, endPoints=(host=localhost, port=29092, listenerName=ListenerName(PLAINTEXT), securityProtocol=PLAINTEXT), rack=null)) to broker localhost:29092 (id: 1 rack: null). Reconnecting to broker. (kafka.controller.RequestSendThread)
kafka_1 | java.io.IOException: Connection to 1 was disconnected before the response was read
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1$$anonfun$apply$1.apply(NetworkClientBlockingOps.scala:114)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1$$anonfun$apply$1.apply(NetworkClientBlockingOps.scala:112)
kafka_1 | at scala.Option.foreach(Option.scala:257)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1.apply(NetworkClientBlockingOps.scala:112)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$$anonfun$blockingSendAndReceive$extension$1.apply(NetworkClientBlockingOps.scala:108)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.recursivePoll$1(NetworkClientBlockingOps.scala:136)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.kafka$utils$NetworkClientBlockingOps$$pollContinuously$extension(NetworkClientBlockingOps.scala:142)
kafka_1 | at kafka.utils.NetworkClientBlockingOps$.blockingSendAndReceive$extension(NetworkClientBlockingOps.scala:108)
kafka_1 | at kafka.controller.RequestSendThread.liftedTree1$1(ControllerChannelManager.scala:196)
kafka_1 | at kafka.controller.RequestSendThread.doWork(ControllerChannelManager.scala:188)
kafka_1 | at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
kafka_1 | [2017-05-08 21:01:07,618] INFO [Controller-1-to-broker-1-send-thread], Controller 1 connected to localhost:29092 (id: 1 rack: null) for sending state change requests (kafka.controller.RequestSendThread)
kafka_1 | [2017-05-08 21:01:07,619] ERROR Processor got uncaught exception. (kafka.network.Processor)
kafka_1 | java.lang.NoClassDefFoundError: Could not initialize class kafka.network.RequestChannel$
kafka_1 | at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:111)
kafka_1 | at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:513)
kafka_1 | at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:505)
kafka_1 | at scala.collection.Iterator$class.foreach(Iterator.scala:893)
kafka_1 | at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
kafka_1 | at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
kafka_1 | at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
kafka_1 | at kafka.network.Processor.processCompletedReceives(SocketServer.scala:505)
kafka_1 | at kafka.network.Processor.run(SocketServer.scala:433)
kafka_1 | at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:4)
Docker最近更名为Moby,这引起了我的问题。我需要在我的docker-compose config中添加moby作为localhost。
通过添加解析moby的extra_hosts
参数作为localhost将解决此问题:
extra_hosts:
- "moby:127.0.0.1"
有关此错误的修正请求为here。
要解决此问题,请输入:
git pull origin pull/258/head
。如果您还想了解其根本原因click here。