As mentioned, we recommend using Cruise Control where possible. Currently Strimzi offers first-class support for three use cases:
Balancing the whole cluster. This uses the KafkaRebalance custom resource.
Assigning replicas to newly-added brokers. This uses a KafkaRebalance with spec.mode set to add-broker, which was added in Strimzi 0.29.
Reassigning replicas away from brokers prior to scaling down the cluster. This uses a KafkaRebalance with spec.model set to remove-broker. This was also added in Strimzi 0.29.
These use cases are covered extensively in the Strimzi documentation.
The Strimzi community is also planning further integration with Cruise Control, as follows:
Simplifying the existing rebalancing functionality using auto-approval.
Automatic rebalance on scaling the broker up or down using auto-rebalance.
Better supporting changing the replication factor of individual topics using the Topic Operator.
There are a couple of common use cases where the tool can be used:
Changing the preferred leader of one or more partitions. Followed by forcing the election of the preferred leader, this can be used to change the leadership of a given partition.
Moving data from one volume to another on the same broker. This is necessary prior to removing a volume from JBOD storage. (To utilise a newly added JBOD volume it’s probably more convenient to perform a global rebalance using KafkaRebalance once the volume has been added).
In the rest of this post we’ll dive into how the tool works, and then go through some examples based on these use cases.