rpk cluster partitions transfer-leadership

Transfer partition leadership between brokers. This command supports transferring only one partition leader at a time.

Redpanda tries to balance leadership distribution across brokers by default. If the distribution of leaders becomes uneven as a result of transferring leadership across brokers, the cluster may move leadership back to the original brokers automatically.

Usage

rpk cluster partitions transfer-leadership [flags]

Examples

To transfer partition leadership for a partition 0 to a broker ID 2, run:

rpk cluster partitions transfer-leadership foo --partition 0:2

The --partition flag accepts a value <A>:<B>, where A is a topic-partition and B is the ID of the broker to which you want to transfer leadership. To specify a topic-partition, you can use just the partition ID (0) or also use the topic name together with the partition using the following syntax:

rpk cluster partitions transfer-leadership --partition test-topic/0:2

In this case, the name of the topic is test-topic and the partition ID is 0.

The preceding examples transfer leadership for the partition kafka/test-topic/0. The command behavior is based on the assumption that the default namespace is kafka, but you can also specify an internal namespace using the {namespace}/ prefix.

Flags

Value Type Description

--format

string

Output format. Possible values: json, yaml, text, wide, help. Default: text.

-h, --help

-

Help for transfer-leadership.

-p, --partition

string

Specify the topic-partition’s leadership to transfer and the location of the new leader. Use the syntax -p <topic-partition>:<new-leader-broker-ID>.

--config

string

Redpanda or rpk config file; default search paths are /var/lib/redpanda/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings. See rpk -X or execute rpk -X help for inline detail or rpk -X list for terser detail.

--profile

string

Profile to use. See rpk profile for more details.

-v, --verbose

-

Enable verbose logging.