问题描述:
在linux云服务器上搭建了一套kafka3.0集群,然后按照以前的创建topic指令:
./kafka-topics.sh --zookeeper hadoop01:2181,hadoop02:2181,hadoop03:2181 --replication-factor 1 --partitions 1 --topic test
然而,却出现了这样一个异常提示:
Exception in thread "main" joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
at joptsimple.OptionParser.parse(OptionParser.java:396)
at kafka.admin.TopicCommand$TopicCommandOptions.<init>(TopicCommand.scala:517)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:47)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
问题原因:
新版本的kafka,已经不需要依赖zookeeper来创建topic,通过查看./kafka-topics.sh --help帮助,可以看到已经没有--zookeeper的选项。
解决办法:
新版的kafka创建topic指令为下:
./kafka-topics.sh --create --bootstrap-server hadoop01:9092 --replication-factor 1 --partitions 1 --topic test
标签:option,Kafka3.4,--,zookeeper,kafka,topic,TopicCommand,joptsimple From: https://www.cnblogs.com/yeyuzhuanjia/p/17933201.html