You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I prepare two nodes for kafka. Kafka deploy mode is global, and network mode is host. So every node has a single kafka instance. Other applicaton connect kafka via INSIDE listener without authentication.
Mostly kafka in docker swarm works well. But when I restart kafka or kafka automaticlly restart, the applications connecting kafka would fail and raise HostException, that because Kafka container host had changed, thus the INSIDE listener address had also changed. Other applications cannot perceive kafka INSIDE listener's changes, so this error occurs.
I try the solution:
change INSIDE listener to a fixed name. like INSIDE://kafka0:9092. But zookeeper don't allow to have same listener for different broker.
java.lang.IllegalArgumentException: requirement failed: Configured end points kafka0:9092 in advertised listeners are already registered by broker 1002
at kafka.server.KafkaServer.$anonfun$createBrokerInfo$3(KafkaServer.scala:415)
at kafka.server.KafkaServer.$anonfun$createBrokerInfo$3$adapted(KafkaServer.scala:413)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
at kafka.server.KafkaServer.createBrokerInfo(KafkaServer.scala:413)
at kafka.server.KafkaServer.startup(KafkaServer.scala:272)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
fix the hostname of the kafka container. I can get a fixed INSIDE listener, but other apps can't access the hostname. Seems to be not easy to config hosts of all service in docker swarm for kafka.
Last solution is modify kafka clients of other apps to catch hostexception and force to reconnect to the new hosts. I think it is too troublesome to do so I have not try it.
I can not connect kafka via outside listener(there are some strange problems), so i can do nothing now, I hope someone can help, be grateful!
The text was updated successfully, but these errors were encountered:
hustlibraco
changed the title
Kafka can't be connected after restart in docker swarm mode
Kafka can't be connected after restart on docker swarm mode
Mar 12, 2021
hustlibraco
changed the title
Kafka can't be connected after restart on docker swarm mode
Kafka can't be connected after restart on docker swarm
Mar 12, 2021
I prepare two nodes for kafka. Kafka deploy mode is global, and network mode is host. So every node has a single kafka instance. Other applicaton connect kafka via INSIDE listener without authentication.
Mostly kafka in docker swarm works well. But when I restart kafka or kafka automaticlly restart, the applications connecting kafka would fail and raise HostException, that because Kafka container host had changed, thus the INSIDE listener address had also changed. Other applications cannot perceive kafka INSIDE listener's changes, so this error occurs.
I try the solution:
INSIDE://kafka0:9092
. But zookeeper don't allow to have same listener for different broker.fix the hostname of the kafka container. I can get a fixed INSIDE listener, but other apps can't access the hostname. Seems to be not easy to config hosts of all service in docker swarm for kafka.
Last solution is modify kafka clients of other apps to catch hostexception and force to reconnect to the new hosts. I think it is too troublesome to do so I have not try it.
I can not connect kafka via outside listener(there are some strange problems), so i can do nothing now, I hope someone can help, be grateful!
Here is my docker swarm config:
The text was updated successfully, but these errors were encountered: