kafka-preferred-replica-election.sh Shell Script

kafka-preferred-replica-election.sh is a shell script to launch kafka.admin.PreferredReplicaLeaderElectionCommand standalone application for Preferred Replica Leader Election.

Among the supported options, kafka-preferred-replica-election.sh accepts a JSON file with partitions to include in election.

$ kafka-topics.sh \
    --bootstrap-server kafka:9092 \
    --create \
    --topic t1 \
    --partitions 3 \
    --replication-factor 1

$ cat parts.json
{ "partitions":
  [
    { "topic": "t1", "partition": 0 },
    { "topic": "t1", "partition": 1 }
  ]
}

$ kafka-preferred-replica-election.sh \
  --bootstrap-server :9092 \
  --path-to-json-file parts.json
Successfully completed preferred replica election for partitions t1-1, t1-0

When executed with no options, kafka-preferred-replica-election.sh assumes --help.

$ kafka-preferred-replica-election.sh
This tool helps to causes leadership for each partition to be transferred back to the 'preferred replica', it can be used to balance leadership among the servers.
Option                                  Description
------                                  -----------
--admin.config <String: config file>    Admin client config properties file to
                                          pass to the admin client when --
                                          bootstrap-server is given.
--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 unless --zookeeper
                                          is given.
--help                                  Print usage information.
--path-to-json-file <String: list of    The JSON file with the list of
  partitions for which preferred          partitions for which preferred
  replica leader election needs to be     replica leader election should be
  triggered>                              done, in the following format -
                                        {"partitions":
                                        	[{"topic": "foo", "partition": 1},
                                        	 {"topic": "foobar", "partition": 2}]
                                        }
                                        Defaults to all existing partitions
--version                               Display Kafka version.
--zookeeper <String: urls>              DEPRECATED. The connection string for
                                          the zookeeper connection in the form
                                          host:port. Multiple URLS can be
                                          given to allow fail-over. Replaced
                                          by --bootstrap-server, REQUIRED
                                          unless --bootstrap-server is given.

results matching ""

    No results matching ""