0

I am not able to receive any data from Kafka server to my consumer server.

Kafka Server is hosted in 192.168.1.1 and consumer is hosted in 192.168.1.2 Using kafka-python lib.

Below is my example

from kafka import KafkaConsumer

consumer = KafkaConsumer('test', bootstrap_servers=['192.168.1.1:9092'],
                     auto_offset_reset='earliest', enable_auto_commit=True,
                     auto_commit_interval_ms=1000)
for message in consumer:
    print(message);

If I will add wrong port number or IP address its throws exception and which is good sign its connected successfully but when Producer send data it won't be work in 192.168.1.2 this IP address but if I am trying same in 192.168.1.1 this IP address working fine.

Do I need to change any configuration, Please guid me I am new in Kafka.

Thank You

Harsh
  • 1
  • 1

1 Answers1

0

You need to configure your server (broker) to have the correct advertised.listener.

Have a read of this blog, and try out this Python code here to understand what's going on with your broker and client.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
  • Yes changed **advertised.listner** ip address but still having below connection msg `kafka.errors.NoBrokersAvailable: NoBrokersAvailable` – Harsh Jun 16 '20 at 06:16