启动新的broken容器内已经增加host 10.10.3.1 kafka.com
设置KAFKA_LISTENERS=PLAINTEXT://kafka.com:12340 启动kafka失败
org.apache.kafka.common.KafkaException: Socket server failed to bind to kafka.com:12340: Address not available.
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:671)
at kafka.network.Acceptor.<init>(SocketServer.scala:539)
at kafka.network.SocketServer.createAcceptor(SocketServer.scala:280)
at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1(SocketServer.scala:253)
at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1$adapted(SocketServer.scala:251)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:553)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:551)
at scala.collection.AbstractIterable.foreach(Iterable.scala:920)
at kafka.network.SocketServer.createDataPlaneAcceptorsAndProcessors(SocketServer.scala:251)
at kafka.network.SocketServer.startup(SocketServer.scala:125)
at kafka.server.KafkaServer.startup(KafkaServer.scala:303)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
Caused by: java.net.BindException: Address not available
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:78)
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:667)
设置KAFKA_LISTENERS=PLAINTEXT://kafka.com:9888 同样失败
1、确保容器内可正常的生产和消费。
2、你这个配置挺麻烦的,容器内也要配置hosts(因为你用的域名)
,因为kafka客户端(你的python)获取的是KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9888
这个,所以你要配置成KAFKA_LISTENERS=PLAINTEXT://kafka.com:12340
。
3、端口最好保持一致,不然要做2次路由,比较绕。
你读读这篇文章,核心一定要理解,因为你这个问题很绕,你必须理解不能访问的核心。
kafka外网转发