Search code examples
apache-kafkakafka-producer-api

Running kafka-console-producer.sh to another server


I have installed Apache Kafka on my centos server. I am simply trying to write a message to a topic on another server. So after installing, I did NOT start the zookeeper or the Kafka server, but simply typed in the command:

echo testing | ./kafka-console-producer.sh --broker-list xxx.yyy.com:2181 --topic topicx

I am able to ping xxx.yyy.com from my server. When I run this, I get this error:

ERROR Error when sending message to topic cds_organization with key: null, value: 7 bytes with error:
(org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Topic topicx not present in metadata after 60000 ms.

So in this scenario, do I still need to start the zookeeper and/or kafka server?


Solution

  • I finally got this working. The issue was that the Kafka server which had the topic I was trying to write to was on version 0.8.2.1, and I had installed the latest version. When I installed the same version, kafka-console-producer.sh worked fine WITHOUT having to start either zookeeper or the local Kafka server.