Kafka创建主题失败:ERROR java.lang.IllegalArgumentException: Topic 'first' does not exist as expected
The error message indicates that the topic named 'first' does not exist when it was expected to exist. This error is thrown by Kafka's TopicCommand class, specifically in the method `ensureTopicExists`. \n\nTo resolve this issue, you can manually create the topic named 'first' before trying to use it. You can use the Kafka command line tool `kafka-topics.sh` to create the topic. Here is an example command to create the 'first' topic with default settings: \n\n\nkafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic first\n\n\nMake sure that the ZooKeeper connection string and port are correct for your Kafka setup. After creating the topic, you should be able to use it without encountering the IllegalArgumentException.
原文地址: https://www.cveoy.top/t/topic/pSvx 著作权归作者所有。请勿转载和采集!