由于下面的错误,我无法启动Kafka Server.
java.io.IOException: Map failed at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:940) at kafka.log.AbstractIndex.(AbstractIndex.scala:61) at kafka.log.TimeIndex. (TimeIndex.scala:55) at kafka.log.LogSegment. (LogSegment.scala:73) at kafka.log.Log.loadSegments(Log.scala:267) at kafka.log.Log. (Log.scala:116) at kafka.log.LogManager$$anonfun$createLog$1.apply(LogManager.scala:365) at kafka.log.LogManager$$anonfun$createLog$1.apply(LogManager.scala:361) at scala.Option.getOrElse(Option.scala:121) at kafka.log.LogManager.createLog(LogManager.scala:361) at kafka.cluster.Partition$$anonfun$getOrCreateReplica$1.apply(Partition.scala:109) at kafka.cluster.Partition$$anonfun$getOrCreateReplica$1.apply(Partition.scala:106) at kafka.utils.Pool.getAndMaybePut(Pool.scala:70) at kafka.cluster.Partition.getOrCreateReplica(Partition.scala:105) at kafka.cluster.Partition$$anonfun$4$$anonfun$apply$3.apply(Partition.scala:166) at kafka.cluster.Partition$$anonfun$4$$anonfun$apply$3.apply(Partition.scala:166) at scala.collection.mutable.HashSet.foreach(HashSet.scala:78) at kafka.cluster.Partition$$anonfun$4.apply(Partition.scala:166) at kafka.cluster.Partition$$anonfun$4.apply(Partition.scala:160) at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:213) at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:221) at kafka.cluster.Partition.makeLeader(Partition.scala:160) at kafka.server.ReplicaManager$$anonfun$makeLeaders$4.apply(ReplicaManager.scala:754) at kafka.server.ReplicaManager$$anonfun$makeLeaders$4.apply(ReplicaManager.scala:753) at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99) at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99) at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230) at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40) at scala.collection.mutable.HashMap.foreach(HashMap.scala:99) at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:753) at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:698) at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:148) at kafka.server.KafkaApis.handle(KafkaApis.scala:84) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:62) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.OutOfMemoryError: Map failed at sun.nio.ch.FileChannelImpl.map0(Native Method) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:937) ... 34 more
尝试以下选项.但没用 请帮忙
将操作系统从32位升级到64位.
将Java堆大小增加到1 GB.
卸载并安装了Apache Kafka
如果这不能解决问题,您可以尝试增加vm.max_map_count.默认值为65536(选中此项sysctl vm.max_map_count
)
有了cat /proc/[kafka-pid]/maps | wc -l
你可以看到有多少映射使用.
增加设置:
sysctl -w vm.max_map_count=262144
将JVM升级到64位解决了这个问题