change the order of your commands *bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test*
On Tue, Nov 3, 2015 at 7:23 AM, Kishore N C <kishor...@gmail.com> wrote: > Hi all, > > I have a 3-node Kafka cluster. I'm running into the following error when I > try to use the console producer to write to a topic that does *not* yet > exist. I have ensured that "auto.create.topics.enable=true" in > server.properties. > > The error: > > ubuntu@ip-XX-X-XXX-XX:/usr/local/kafka$ bin/kafka-console-producer.sh > --topic sampletopic --broker-list localhost:9082 > [2015-11-03 12:00:01,011] WARN Property topic is not valid > (kafka.utils.VerifiableProperties) > Hey > [2015-11-03 12:00:04,304] WARN Error while fetching metadata > [{TopicMetadata for topic sampletopic -> > No partition metadata for topic sampletopic due to > kafka.common.UnknownTopicOrPartitionException}] for topic [sampletopic]: > class kafka.common.UnknownTopicOrPartitionException > (kafka.producer.BrokerPartitionInfo) > [2015-11-03 12:00:04,312] WARN Error while fetching metadata > [{TopicMetadata for topic sampletopic -> > No partition metadata for topic sampletopic due to > kafka.common.UnknownTopicOrPartitionException}] for topic [sampletopic]: > class kafka.common.UnknownTopicOrPartitionException > (kafka.producer.BrokerPartitionInfo) > [2015-11-03 12:00:04,313] ERROR Failed to collate messages by topic, > partition due to: Failed to fetch topic metadata for topic: sampletopic > (kafka.producer.async.DefaultEventHandler) > ... > > Once I create the topic, I am able to write to it: > > ubuntu@ip-XX-X-XXX-XX:/usr/local/kafka$ bin/kafka-topics.sh --create > --zookeeper localhost:2181 --replication-factor 2 --partitions 2 --topic > sampletopic > Created topic "sampletopic". > ubuntu@ip-10-1-100-75:/usr/local/kafka$ bin/kafka-console-producer.sh > --topic sampletopic --broker-list localhost:9082 > [2015-11-03 12:09:01,940] WARN Property topic is not valid > (kafka.utils.VerifiableProperties) > Hey > Hello > ^Cubuntu@ip-10-1-100-75:/usr/local/kafka$ bin/kafka-console-consumer.sh > --zookeeper localhost:2181 --from-beginning --topic sampletopic > Hey > Hello > ^CConsumed 2 messages > > Any idea what I am doing wrong or how I should troubleshoot this issue? > > Regards, > > KN. >