Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

kafka-console-producer.sh

SOLVED Go to solution
Highlighted

kafka-console-producer.sh

Explorer

Hi, 

 

I am not able to produce the msg on cloudera. I am running below command get the error. 

 

COMMAND:

kafka-console-producer.sh \
--broker-list localhost:9092 \
--topic kafkademo1

 

ERRPR MSG: 

 

WARN [Producer clientId=console-producer] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

 

 

 

Need support in this regard. 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: kafka-console-producer.sh

Rising Star
Hi,

Please use the below steps if your cluster is unsecure.

kafka-topics --create --zookeeper <zk host>:2181 --replication-factor 3 --partitions 1 --topic Testmessage

Run a Kafka console producer:
$ kafka-console-producer --broker-list <broker hostnome>:9092 --topic Testmessage
 
Run a Kafka console consumer:
$ kafka-console-consumer --new-consumer --topic Testmessage --from-beginning --bootstrap-server <broker hostnome>:9092

Thanks
Jerry
4 REPLIES 4

Re: kafka-console-producer.sh

Rising Star
Hi,

From the logs, It seems its unable to find the broker "Connection to node -1 (localhost/127.0.0.1:9092) could not be established"

Make sure you have broker running in the node and listening to 9092
Also try adding the fully qualified name or IP instead of localhost

Thanks
Jerry

Re: kafka-console-producer.sh

Explorer

Hi Jerry, 

 

After replacing localhost to hostname "quickstart.cloudera" it is working , but now I am not getting messages in my consumers terminal. I follow the below commands. 

 

 

kafka-console-producer.sh --broker-list quickstart.cloudera:9092 --topic test-1
>welcome to
>

 

 

kafka-console-consumer.sh --bootstrap-server quickstart.cloudera:9092 --topic test-1 --from-beginning

 

 

Pleaes let me know what could be the problem. 

 

Regards, 

 

Aamir 

 

 

Re: kafka-console-producer.sh

Rising Star
Hi,

Please use the below steps if your cluster is unsecure.

kafka-topics --create --zookeeper <zk host>:2181 --replication-factor 3 --partitions 1 --topic Testmessage

Run a Kafka console producer:
$ kafka-console-producer --broker-list <broker hostnome>:9092 --topic Testmessage
 
Run a Kafka console consumer:
$ kafka-console-consumer --new-consumer --topic Testmessage --from-beginning --bootstrap-server <broker hostnome>:9092

Thanks
Jerry

Re: kafka-console-producer.sh

Explorer

Hi Jerry, 

 

It has starting working after I changed the property "offsets.topic.replication.factor" 3 to 1. 

 

Thanks for your support.

 

Aamir.