首页 > 技术文章 > Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option

skzxc 2021-12-20 09:25 原文

在创建主题时,

在较新版本(2.2 及更高版本)的 Kafka 不再需要 ZooKeeper 连接字符串,即- -zookeeper localhost:2181。使用 Kafka Broker的 --bootstrap-server localhost:9092来替代- -zookeeper localhost:2181。

即使用命令:

bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test

替代命令:

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

 

推荐阅读