I created a topic using following command:
./kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 2 --partitions 2 --topic testTopic
When I tried producing the records using console producer, I see following messages on producer console:
Error while fetching metadata with correlation id 0 : {testTopic=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
The command I used to start console producer:
./kafka-console-producer.sh --broker-list broker1:9092 broker2:9092 --topic testTopic
The output of topic describe is as follows:
kafka-topics.sh --zookeeper zookeeper:2181 --describe --topic testTopic
Topic:testTopic PartitionCount:2 ReplicationFactor:2 Configs:
Topic: testTopic Partition: 0 Leader: none Replicas: 2,1 Isr:
Topic: testTopic Partition: 1 Leader: none Replicas: 1,2 Isr:
Looking at above output this question is not a duplicate of this. There is no leader assigned to the partitions.
What could be possible reason behind this behavior?