1

When I try to expand the replicas for specific topic with reassign shell, I got 'zookeeper is not a recognized option' error. The shell script as below:

kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file reassign.json --execute

I got the result as below:

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.ReassignPartitionsCommand$ReassignPartitionsCommandOptions.<init>(ReassignPartitionsCommand.scala:1498) at kafka.admin.ReassignPartitionsCommand$.validateAndParseArgs(ReassignPartitionsCommand.scala:1332) at kafka.admin.ReassignPartitionsCommand$.main(ReassignPartitionsCommand.scala:194) at kafka.admin.ReassignPartitionsCommand.main(ReassignPartitionsCommand.scala)

Expection: zookeeper could be a valid option for the reassign shell

ps: Kafka Version: 3.0

  • Does this answer your question? [zookeeper is not a recognized option when executing kafka-console-consumer.sh](https://stackoverflow.com/questions/53428903/zookeeper-is-not-a-recognized-option-when-executing-kafka-console-consumer-sh) – Augusto Mar 22 '23 at 09:40
  • Not really, as far as I known, the new kafka support --bootstrap-server option and the option --zookeeper is deprecated, but with shell 'kafka-reassign-partitions.sh', we may not use it to expand new replicas since bootstrap-server option adjusts dynamic parameter. What's more, if I use bootstrap-server option, it got 'Error: Unknown broker id 0' error. – Abral George Mar 22 '23 at 11:14

1 Answers1

0

Zookeeper flag was removed.

You'll need to download an older version of Kafka tools to get it back

if I use bootstrap-server option, it got 'Error: Unknown broker id 0' error.

We don't know what broker ids exist in your cluster. Edit your mapping file to use correct ids

bootstrap-server option adjusts dynamic parameter

Unclear what this means. No values are dynamic.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • For the current kafka version, the shell script kafka-reassign-partitions.sh do not support 'zookeeper' option, if I want to add replicas for some topics, how should I do? Sorry for unclear broker ids of the cluster, my cluster broker set is [1, 2, 3], how can I specify broker id for the shell script in command line? – Abral George Mar 23 '23 at 01:00
  • As compared case, I do this in the k8s kafka pod to reassign replicas, which kafka version is bitnami/v2.5.1, and the kafka-reassign-partitions.sh own zookeeper option. When I finish executing the script 'kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file reassign.json --verify', I got 'Status of partition reassignment: Reassignment of partition xxx-0 failed Reassignment of partition xxx-1 failed Reassignment of partition xxx-2 failed' – Abral George Mar 23 '23 at 11:47
  • If you're executing that command from a Kafka pod, then that's not Zookeeper, so localhost:2181 is not the correct address – OneCricketeer Mar 25 '23 at 16:21