Joe jim
Joe jim

Reputation: 59

Kafka Producer From Remote Server

I'm developing a streaming API with Apache Kafka version (2.1.0). I have a Kafka cluster and an external server. The external Server will be producing data to be consumed on the Kafka cluster.

Let's denote the external Server as E and the cluster as C . E doesn't have Kafka installed. I run on it a JAR file to produce messages. Here is the snippet for Producer properties:

properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "bootstrapIp:9092");
properties.put(ProducerConfig.CLIENT_ID_CONFIG, "producer");

I set bootstrapIp to the Kafka broker IP.

In the cluster side, I start the consumer console using this command:

kafka-console-consumer --bootstrap-server bootstrapIp:9092 --topic T1 --from-beginning

I set bootstrapIp to the cluster bootstrap server IP.

When running the producer and the consumer on the cluster, it works very fine, but when i run the producer in the external server (E) and the consumer in the cluster (C) the data not being consumed.

In localhost every thing is working fine also when i run the producer and the consumer in the cluster (C) everything is working fine, when running the producer externally i can't consume the data in the cluster.

The ping from cluster(C) to external server (E) is working, but i can't see where the problem is exactly.

I am not able to figure out how to consume messages from an external server.

EDIT

From the external server (E) i telnet the (bootstrapIp): telnet bootstrapIp 9092 and it works, i don't understand the problem

Upvotes: 5

Views: 3530

Answers (1)

jpm1590
jpm1590

Reputation: 21

Tbis works for me: From server.properties Uncomment

listeners=PLAINTEXT://:9092

And

advertised.listeners=PLAINTEXT://<HOST IP>:9092

Replace with actual IP. My case:

advertised.listeners=PLAINTEXT://192.168.75.132:9092

Upvotes: 2

Related Questions