在AWS上部署Kafka

时间:2017-06-20 13:17:40

标签: java scala amazon-web-services apache-kafka kafka-consumer-api

我正在尝试在aws上部署kafka。运行kafka服务器时,我收到以下错误:

kafka.common.KafkaException: Socket server failed to bind to hostname:9092: Cannot assign requested address.
        at kafka.network.Acceptor.openServerSocket(SocketServer.scala:309)
        at kafka.network.Acceptor.<init>(SocketServer.scala:237)
        at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:108)
        at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:91)
        at scala.collection.Iterator$class.foreach(Iterator.scala:742)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
        at scala.collection.MapLike$DefaultValuesIterable.foreach(MapLike.scala:206)
        at kafka.network.SocketServer.startup(SocketServer.scala:91)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:179)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
        at kafka.Kafka$.main(Kafka.scala:67)
        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:305)

有人对此有所了解吗?提前谢谢。

1 个答案:

答案 0 :(得分:1)

尝试将advertised.listeners设置为public elastic ip,这样初始引导元数据请求将返回客户端可以实际连接的ip。