我看網上不少說是 Kafka在啓動一段時間後,若是出現服務自動關閉狀況,可在啓動kafka的時使用守護進程模式啓動,即在原啓動命令中加 -daemon nohup /home/kafka_2.11-1.0.0/bin/kafka-server-start.sh -daemon /home/kafka_2.11-1.0.0/config/server.properties1 & 但是我加上也不行 ,還有的說是內存不夠 , 以上問題可能會存在吧 ,網上都參考不如本身看下log日誌, 到本身定義的kafka 日誌輸出的目錄下找到 server.log 而後查看下java
[2018-05-22 16:03:23,994] INFO Starting log flusher with a default period of 9223372036854775807 ms. (kafka.log.LogManager)
[2018-05-22 16:03:26,260] FATAL [KafkaServer id=2] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.KafkaException: Socket server failed to bind to 192.168.252.11:9092: Cannot assign requested address.
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:331)
at kafka.network.Acceptor.<init>(SocketServer.scala:256)
at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:97)
at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:89)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at kafka.network.SocketServer.startup(SocketServer.scala:89)
at kafka.server.KafkaServer.startup(KafkaServer.scala:229)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:92)
at kafka.Kafka.main(Kafka.scala)
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:327)
... 10 more
[2018-05-22 16:03:26,294] INFO [KafkaServer id=2] shutting down (kafka.server.KafkaServer)
[2018-05-22 16:03:26,310] INFO [SocketServer brokerId=2] Shutting down (kafka.network.SocketServer)app
看以上的錯 說是Socket server 沒法綁定 192.168.252.11:9092 沒法獲取地址 遇到這個錯 多是server.properties 配置錯了 而後找到 server.properties 配置下spa
listeners=PLAINTEXT://192.168.252.12:9092 或 advertised.listeners=PLAINTEXT://your.host.name:9092 .net
配置完後從新啓動就ok 了 scala