kafka.common.KafkaException: Socket server failed to bind to hdp1:9092: Cannot assign requested addr
Posted questionszhang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kafka.common.KafkaException: Socket server failed to bind to hdp1:9092: Cannot assign requested addr相关的知识,希望对你有一定的参考价值。
ERROR [KafkaServer id=1] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:404)
at kafka.network.Acceptor.<init>(SocketServer.scala:308)
at kafka.network.SocketServer$$anonfun$createAcceptorAndProcessors$1.apply(SocketServer.scala:126)
at kafka.network.SocketServer$$anonfun$createAcceptorAndProcessors$1.apply(SocketServer.scala:122)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at kafka.network.SocketServer.createAcceptorAndProcessors(SocketServer.scala:122)
at kafka.network.SocketServer.startup(SocketServer.scala:84)
at kafka.server.KafkaServer.startup(KafkaServer.scala:247)
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:400)
... 11 more
[2019-01-14 23:12:26,937] INFO [KafkaServer id=1] shutting down (kafka.server.KafkaServer)
[2019-01-14 23:12:26,938] INFO [SocketServer brokerId=1] Stopping socket server request processors (kafka.network.SocketServer)
[2019-01-14 23:12:26,939] INFO [SocketServer brokerId=1] Stopped socket server request processors (kafka.network.SocketServer)
[2019-01-14 23:12:26,942] INFO Shutting down. (kafka.log.LogManager)
[2019-01-14 23:12:26,955] INFO Shutdown complete. (kafka.log.LogManager)
[2019-01-14 23:12:26,955] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2019-01-14 23:12:26,961] INFO Session: 0x3684fa4f09a000d closed (org.apache.zookeeper.ZooKeeper)
[2019-01-14 23:12:26,961] INFO EventThread shut down for session: 0x3684fa4f09a000d (org.apache.zookeeper.ClientCnxn)
[2019-01-14 23:12:26,962] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2019-01-14 23:12:26,962] INFO [ThrottledRequestReaper-Fetch]: Shutting down (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,643] INFO [ThrottledRequestReaper-Fetch]: Stopped (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,644] INFO [ThrottledRequestReaper-Fetch]: Shutdown completed (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,644] INFO [ThrottledRequestReaper-Produce]: Shutting down (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,656] INFO [ThrottledRequestReaper-Produce]: Stopped (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,656] INFO [ThrottledRequestReaper-Produce]: Shutdown completed (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:27,656] INFO [ThrottledRequestReaper-Request]: Shutting down (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:28,675] INFO [ThrottledRequestReaper-Request]: Stopped (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:28,675] INFO [ThrottledRequestReaper-Request]: Shutdown completed (kafka.server.ClientQuotaManager$ThrottledRequestReaper)
[2019-01-14 23:12:28,677] INFO [SocketServer brokerId=1] Shutting down socket server (kafka.network.SocketServer)
[2019-01-14 23:12:28,710] INFO [SocketServer brokerId=1] Shutdown completed (kafka.network.SocketServer)
[2019-01-14 23:12:28,714] INFO [KafkaServer id=1] shut down completed (kafka.server.KafkaServer)
[2019-01-14 23:12:28,715] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2019-01-14 23:12:28,717] INFO [KafkaServer id=1] shutting down (kafka.server.KafkaServer)
错误原因,一个小问题
自己copy了server.properties文件到各个节点没有修改下面的配置 监听器的配置,应该指向节点本身的主机名和端口,我全部四台机器都指向了hdp1,所以导致了只有节点1是正常的
listeners=PLAINTEXT://hdp4:9092
以上是关于kafka.common.KafkaException: Socket server failed to bind to hdp1:9092: Cannot assign requested addr的主要内容,如果未能解决你的问题,请参考以下文章