OS Manuals

/usr/lib/kafka/bin/kafka-leader-election.sh

Community edition of Confluent Kafka.

From confluent-kafka 8.4.0.215-r1 (os), captured 2026-11-08 by running kafka-leader-election.sh --help (exit 1). permalink

Also provided by 1 other package version
This tool attempts to elect a new leader for a set of topic partitions. The type of elections supported are preferred replicas and unclean replicas.
Option                                  Description
------                                  -----------
--admin.config <String: config file>    (DEPRECATED) Configuration properties
                                          files to pass to the admin client.
                                          This option will be removed in a
                                          future version. Use --command-config
                                          instead.
--all-topic-partitions                  Perform election on all of the
                                          eligible topic partitions based on
                                          the type of election (see the --
                                          election-type flag). Not allowed if
                                          --topic or --path-to-json-file is
                                          specified.
--bootstrap-server <String: host:port>  A hostname and port for the broker to
                                          connect to, in the form host:port.
                                          Multiple comma separated URLs can be
                                          given. REQUIRED.
--command-config <String: Config file>  Config properties file to pass to the
                                          admin client.
--election-type <[PREFERRED,UNCLEAN]:   Type of election to attempt. Possible
  election type>                          values are "preferred" for preferred
                                          leader election or "unclean" for
                                          unclean leader election. If
                                          preferred election is selection, the
                                          election is only performed if the
                                          current leader is not the preferred
                                          leader for the topic partition. If
                                          unclean election is selected, the
                                          election is only performed if there
                                          are no leader for the topic
                                          partition. REQUIRED.
--help                                  Print usage information.
--partition <Integer: partition id>     Partition id for which to perform an
                                          election. REQUIRED if --topic is
                                          specified.
--path-to-json-file <String: Path to    The JSON file with the list  of
  JSON file>                              partition for which leader elections
                                          should be performed. This is an
                                          example format.
                                        {"partitions":
                                        	[{"topic": "foo", "partition": 1},
                                        	 {"topic": "foobar", "partition": 2}]
                                        }
                                        Not allowed if --all-topic-partitions
                                          or --topic flags are specified.
--topic <String: topic name>            Name of topic for which to perform an
                                          election. Not allowed if --path-to-
                                          json-file or --all-topic-partitions
                                          is specified.
--version                               Display Kafka version.
Options (10)
OptionDescriptionSource
--admin.config String:(DEPRECATED) Configuration properties files to pass to the admin client.help
--all-topic-partitionsPerform election on all of the eligible topic partitions based on the type of election (see the -- election-type flag).help
--bootstrap-server String:A hostname and port for the broker to connect to, in the form host:port.help
--command-config String:Config properties file to pass to the admin client.help
--election-type PREFERREDType of election to attempt.help
--helpPrint usage information.help
--partition Integer:Partition id for which to perform an election.help
--path-to-json-file String:The JSON file with the list of JSON file> partition for which leader elections should be performed.help
--topic String:Name of topic for which to perform an election.help
--versionDisplay Kafka version.help

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.