0

I've setup a very basic kafka broker on gitpod.
I would now like to access it from a python notebook using kafka-python

producer = KafkaProducer(bootstrap_servers=['localhost:9092'])

I must replace localhost with the IP of my Gitpod workspace but this would not work 'as is'

Gitpod provides http endpoints with a format that do not meet the standard/usual connection chain (seeb below)
(this is recurring fo all such technologies served on a port, like elasticsearch and such)

My question is :
What should I enter instead of `localhost' to be able to acces my Kafka Broker remotely ?

I would be glad to provide additional context, just ask.

enter image description here

Mehdi LAMRANI
  • 11,289
  • 14
  • 88
  • 130

1 Answers1

1

Kafka (nor Zookeeper) are HTTP(S) services, so you cannot use those links.

Just because there's a forwarded address that's listed in some table shouldn't prevent you from accessing, but localhost will not be correct if all services run as external containers from the IDE environment. Rather than randomly set an address/port, you'll need to understand how advertised.listeners works in kafka, then connect to that

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245