FATAL Fatal error during KafkaServerStable startup. Prepare to shutdown (kafka.server.KafkaServerSta

1、启动kafka的时候,报错如下所示:

 1 [2018-04-24 07:32:02,798] INFO zookeeper state changed (SyncConnected) (org.I0Itec.zkclient.ZkClient)
 2 [2018-04-24 07:32:02,883] FATAL Fatal error during KafkaServerStable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
 3 java.io.FileNotFoundException: /tmp/kafka-logs/.lock (Permission denied)
 4     at java.io.RandomAccessFile.open(Native Method)
 5     at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241)
 6     at kafka.utils.FileLock.<init>(FileLock.scala:29)
 7     at kafka.log.LogManager$$anonfun$lockLogDirs$1.apply(LogManager.scala:93)
 8     at kafka.log.LogManager$$anonfun$lockLogDirs$1.apply(LogManager.scala:92)
 9     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
10     at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
11     at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
12     at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:33)
13     at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
14     at scala.collection.mutable.WrappedArray.map(WrappedArray.scala:33)
15     at kafka.log.LogManager.lockLogDirs(LogManager.scala:92)
16     at kafka.log.LogManager.<init>(LogManager.scala:55)
17     at kafka.server.KafkaServer.createLogManager(KafkaServer.scala:275)
18     at kafka.server.KafkaServer.startup(KafkaServer.scala:72)
19     at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:34)
20     at kafka.Kafka$.main(Kafka.scala:46)
21     at kafka.Kafka.main(Kafka.scala)
22 [2018-04-24 07:32:02,890] INFO [Kafka Server 3], shutting down (kafka.server.KafkaServer)
23 [2018-04-24 07:32:02,916] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)
24 [2018-04-24 07:32:02,924] INFO Session: 0x262f744ac470001 closed (org.apache.zookeeper.ZooKeeper)
25 [2018-04-24 07:32:02,924] INFO [Kafka Server 3], shut down completed (kafka.server.KafkaServer)
26 [2018-04-24 07:32:02,925] INFO EventThread shut down (org.apache.zookeeper.ClientCnxn)
27 [2018-04-24 07:32:02,928] INFO [Kafka Server 3], shutting down (kafka.server.KafkaServer)

2、原因分析,主要是自己是hadoop用户操作,期间无意登陆到root权限,启动了kafka,且启动成功了,创建了如下所示的目录,而且权限是root权限的,当我切换到hadoop用户的时候,启动kafka直接报如下所示的错误:

FATAL Fatal error during KafkaServerStable startup. Prepare to shutdown (kafka.server.KafkaServerSta

3、可以看到目录如下所示,解决方法,可以直接将这个目录删除,重启启动kafka,然后重新生成这个目录即可:

FATAL Fatal error during KafkaServerStable startup. Prepare to shutdown (kafka.server.KafkaServerSta

 

上一篇:设计模式--工厂方法模式


下一篇:實戰案例 - 微信平台之微信商城重點摘要(1)