Robin Moffatt explains common errors people run into when trying to connect to remote Kafka clusters:
In this example, my client is running on my laptop, connecting to Kafka running on another machine on my LAN called
asgard03:The initial connection succeeds. But note that the
BrokerMetadatawe get back shows that there is one broker, with a hostname oflocalhost. That means that our client is going to be usinglocalhostto try to connect to a broker when producing and consuming messages. That’s bad news, because on our client machine, there is no Kafka broker atlocalhost(or if there happened to be, some really weird things would probably happen).
As usual, things boil down to “Configure it correctly and it works.”