使用正确标志的kafka-preferred-replica-election

jmo0nnb3  于 2023-11-16  发布在  Apache
关注(0)|答案(1)|浏览(119)

我们有版本为1.0的Kafka HDP群集
我们想要使用kafka-preferred-replica-election.sh,以便用其他leader ID替换leader ID,并且作为该leader示例的-1结果:

Topic: topic_test     Partition: 0    Leader: -1      Replicas: 1006  Isr: 1006

字符串
但我们会得到以下例外

/usr/hdp/current/kafka-broker/bin/kafka-preferred-replica-election.sh --zookeeper zookeeper01:2181 --topic topic_test  --partition 0  --election-type preferred

GC log rotation is turned off
Exception in thread "main" joptsimple.UnrecognizedOptionException: topic 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.PreferredReplicaLeaderElectionCommand$.main(PreferredReplicaLeaderElectionCommand.scala:49)
        at kafka.admin.PreferredReplicaLeaderElectionCommand.main(PreferredReplicaLeaderElectionCommand.scala



我们也尝试

/usr/hdp/current/kafka-broker/bin/kafka-preferred-replica-election.sh --bootstrap-server kafka01:9092 --topic topic_test  --partition 0  --election-type preferred

To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>
where num_of_file > 0
GC log rotation is turned off
Exception in thread "main" joptsimple.UnrecognizedOptionException: bootstrap-server 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.PreferredReplicaLeaderElectionCommand$.main(PreferredReplicaLeaderElectionCommand.scala:49)
        at kafka.admin.PreferredReplicaLeaderElectionCommand.main(PreferredReplicaLeaderElectionCommand.scala)


我们的Kafka漫画有什么问题吗
参考-https://jaceklaskowski.gitbooks.io/apache-kafka/content/kafka-demo-using-kafka-leader-election.html

hkmswyz6

hkmswyz61#

官方wiki页面上说你需要一个JSON文件,而不是一个主题标志,也不是引导服务器标志。
https://cwiki.apache.org/confluence/plugins/servlet/mobile?contentId=31819985#Replicationtools-1.PreferredReplicaLeaderElectionTool

相关问题