The error you get puts you on the right lines: > Is your advertised.listeners (called advertised.host.name before Kafka 9) correct and resolvable?
This article explains why and how to fix it: https://rmoff.net/2018/08/02/kafka-listeners-explained/ -- Robin Moffatt | Senior Developer Advocate | ro...@confluent.io | @rmoff On Fri, 7 Feb 2020 at 13:21, Marcus Engene <meng...@engene.se> wrote: > Hi, > > I tried to use kafka-python 1.4.7 to connect to a bitnami kafka cluster > using private ip the brokers. > > This works great from another Compute Instance. > > When i try the same code from django on app-engine (that is setup to be > able to use stuff on Compute, f,ex some locally installed Redis), I get > an error: > > ... > 2020-02-07 10:38:30 api[20200207t095208] WARNING:kafka.conn:DNS lookup > failed for kafka-cluster-1-kafka-2:9092, exception was [Errno -2] Name > or service not known. Is your advertised.listeners (called > advertised.host.name before Kafka 9) correct and resolvable? > 2020-02-07 10:38:30 api[20200207t095208] ERROR:kafka.conn:DNS lookup > failed for kafka-cluster-1-kafka-2:9092 (AddressFamily.AF_UNSPEC) > 2020-02-07 10:38:30 api[20200207t095208] WARNING:kafka.conn:DNS lookup > failed for kafka-cluster-1-kafka-2:9092, exception was [Errno -2] Name > or service not known. Is your advertised.listeners (called > advertised.host.name before Kafka 9) correct and resolvable? > 2020-02-07 10:38:30 api[20200207t095208] ERROR:kafka.conn:DNS lookup > failed for kafka-cluster-1-kafka-2:9092 (AddressFamily.AF_UNSPEC) > ... > > Code run is very simple: > > // conf only has sasl params and brokers in the form of > "ip:9092,ip2:9092,ip3:9092" > cls.producer = KafkaProducer(**conf) > > future =cls.producer.send(topic=topic, > value=bytes(value,encoding='utf8'), > key=bytes(key,encoding='utf8'), > headers=None, > partition=None, > timestamp_ms=None) > future.get(timeout=10) # <- in a try/catch > > Where does client side even get to hear about kafka-cluster-1-kafka-2? I > thought client connects to any of the brokers and the will take it from > there? Compute Engine DNS resolves kafka-cluster-1-kafka-2 > magnificently, but not in app-engine. Should connecting side know more > about Kafka rig than the brokers? > Best regards, Marcus > >