안재용
안재용

Reputation: 11

Kafka Broker not available outside of VM Network, even with port forwards

Install kafka info :

  1. Vmware is installed on the Windows 2016 server.
  2. Cent OS 7.1 is installed on Vmware.
  3. kafka installed Cent os 7.1.

Cent OS hosts Add :

<VM GUEST IP> localhost

kafka server.config :

listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://<VM GUEST IP>:9092
host.name=<VM GUEST IP>

VMWare Nat Setting :

19092 > <VM GUEST IP>:9092
12181 > <VM GUEST IP>:2181

Cent OS Firewall open 9092,2181.

Windows Server port open 19092, 12181.And Complete the tcping test from another user's computer.

However, there is no connection between Producer and Customer test.

Test :

bin/kafka-console-producer.sh --broker-list <windows server IP>:19092 --topic <topic>

Result N/A But :

Connection to node 0 (/<VMWare IP>:9092) could not be established. Broker may not be available.

There was nothing wrong with VMWare. Similarly, Producer and Customer tests passed correctly on Windows server.

Other users' computers cannot be accessed.What is the problem?

Upvotes: 0

Views: 550

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191874

The advertised.listeners needs to expose 19092 if you plan on using clients outside of the VM network.

See this blog, replacing "Docker/AWS" with "VMWare"

Example configuration

listeners=INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092
listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
advertised.listeners=INTERNAL://<VM address>:19092,EXTERNAL://<Host Address>:9092
inter.broker.listener.name=INTERNAL

Upvotes: 2

Related Questions