其他分享
首页 > 其他分享> > kafka创建主题

kafka创建主题

作者:互联网

当前版本

kafka_2.13-3.2.1

[root@node2 bin]# ./kafka-topics.sh -create --zookeeper 192.168.1.100:2181,192.168.1.101:2181,192.168.1.102:2181 -replication-factor 3 --partitions 3 --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:567)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:47)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
[root@node2 bin]#

 

高版本kafka得用

[root@master bin]# ./kafka-topics.sh -create --bootstrap-server 192.168.1.100:9092 -replication-factor 3 --partitions 3 --topic test
Created topic test.
[root@master bin]# pwd

高版本不需要依赖zookeeper来创建topic,新版本使用 --bootstrap-server 参数

标签:joptsimple,--,创建,主题,192.168,kafka,topic,TopicCommand
来源: https://www.cnblogs.com/yitian395/p/16674029.html