Kafka - 在 Windows IOException 上创建生产者
Kafka - creating producer on Windows IOException
我 运行 在 Windows 上使用 Apache Kafka。当我 运行 zookeeper 和一个 broker 就可以了。然后我 运行 producer 命令,一切仍然正常。当我 运行 消费者命令时,出现以下错误。我不知道该怎么做,我正在使用 64b JVM。
[2018-07-03 11:47:42,978] ERROR [ReplicaManager broker=0] Error while making broker the leader for partition Topic: __consumer_offsets; Partition: 16; Leader: None; AllReplicas: ; InSyncReplicas: in dir None (kafka.server.ReplicaManager)
org.apache.kafka.common.errors.KafkaStorageException: Error while creating log for __consumer_offsets-16 in dir c:\tmp\kafka-logs
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:940)
at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:67)
at kafka.log.TimeIndex.<init>(TimeIndex.scala:54)
at kafka.log.LogSegment$.open(LogSegment.scala:561)
at kafka.log.Log.loadSegments(Log.scala:412)
at kafka.log.Log.<init>(Log.scala:216)
at kafka.log.Log$.apply(Log.scala:1747)
at kafka.log.LogManager$$anonfun$getOrCreateLog.apply(LogManager.scala:673)
at kafka.log.LogManager$$anonfun$getOrCreateLog.apply(LogManager.scala:641)
at scala.Option.getOrElse(Option.scala:121)
at kafka.log.LogManager.getOrCreateLog(LogManager.scala:641)
at kafka.cluster.Partition$$anonfun$getOrCreateReplica.apply(Partition.scala:177)
at kafka.cluster.Partition$$anonfun$getOrCreateReplica.apply(Partition.scala:173)
at kafka.utils.Pool.getAndMaybePut(Pool.scala:65)
at kafka.cluster.Partition.getOrCreateReplica(Partition.scala:172)
at kafka.cluster.Partition$$anonfun$$anonfun.apply(Partition.scala:259)
at kafka.cluster.Partition$$anonfun$$anonfun.apply(Partition.scala:259)
at scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:234)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at kafka.cluster.Partition$$anonfun.apply(Partition.scala:259)
at kafka.cluster.Partition$$anonfun.apply(Partition.scala:253)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:250)
at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:258)
at kafka.cluster.Partition.makeLeader(Partition.scala:253)
at kafka.server.ReplicaManager$$anonfun$makeLeaders.apply(ReplicaManager.scala:1165)
at kafka.server.ReplicaManager$$anonfun$makeLeaders.apply(ReplicaManager.scala:1163)
at scala.collection.mutable.HashMap$$anonfun$foreach.apply(HashMap.scala:130)
at scala.collection.mutable.HashMap$$anonfun$foreach.apply(HashMap.scala:130)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:236)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:130)
at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:1163)
at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:1083)
at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:183)
at kafka.server.KafkaApis.handle(KafkaApis.scala:108)
at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:937)
... 42 more
我不得不将 32b Java 更改为 64b。
我 运行 在 Windows 上使用 Apache Kafka。当我 运行 zookeeper 和一个 broker 就可以了。然后我 运行 producer 命令,一切仍然正常。当我 运行 消费者命令时,出现以下错误。我不知道该怎么做,我正在使用 64b JVM。
[2018-07-03 11:47:42,978] ERROR [ReplicaManager broker=0] Error while making broker the leader for partition Topic: __consumer_offsets; Partition: 16; Leader: None; AllReplicas: ; InSyncReplicas: in dir None (kafka.server.ReplicaManager)
org.apache.kafka.common.errors.KafkaStorageException: Error while creating log for __consumer_offsets-16 in dir c:\tmp\kafka-logs
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:940)
at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:67)
at kafka.log.TimeIndex.<init>(TimeIndex.scala:54)
at kafka.log.LogSegment$.open(LogSegment.scala:561)
at kafka.log.Log.loadSegments(Log.scala:412)
at kafka.log.Log.<init>(Log.scala:216)
at kafka.log.Log$.apply(Log.scala:1747)
at kafka.log.LogManager$$anonfun$getOrCreateLog.apply(LogManager.scala:673)
at kafka.log.LogManager$$anonfun$getOrCreateLog.apply(LogManager.scala:641)
at scala.Option.getOrElse(Option.scala:121)
at kafka.log.LogManager.getOrCreateLog(LogManager.scala:641)
at kafka.cluster.Partition$$anonfun$getOrCreateReplica.apply(Partition.scala:177)
at kafka.cluster.Partition$$anonfun$getOrCreateReplica.apply(Partition.scala:173)
at kafka.utils.Pool.getAndMaybePut(Pool.scala:65)
at kafka.cluster.Partition.getOrCreateReplica(Partition.scala:172)
at kafka.cluster.Partition$$anonfun$$anonfun.apply(Partition.scala:259)
at kafka.cluster.Partition$$anonfun$$anonfun.apply(Partition.scala:259)
at scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map.apply(TraversableLike.scala:234)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at kafka.cluster.Partition$$anonfun.apply(Partition.scala:259)
at kafka.cluster.Partition$$anonfun.apply(Partition.scala:253)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:250)
at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:258)
at kafka.cluster.Partition.makeLeader(Partition.scala:253)
at kafka.server.ReplicaManager$$anonfun$makeLeaders.apply(ReplicaManager.scala:1165)
at kafka.server.ReplicaManager$$anonfun$makeLeaders.apply(ReplicaManager.scala:1163)
at scala.collection.mutable.HashMap$$anonfun$foreach.apply(HashMap.scala:130)
at scala.collection.mutable.HashMap$$anonfun$foreach.apply(HashMap.scala:130)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:236)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:130)
at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:1163)
at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:1083)
at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:183)
at kafka.server.KafkaApis.handle(KafkaApis.scala:108)
at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:937)
... 42 more
我不得不将 32b Java 更改为 64b。