Skip to content

Commit d1378c0

Browse files
authored
topicctl new action: rebalance (#142)
* topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * topicctl new action: rebalance * README updated with subcomand rebalance information * Updated topicctl version * README updated with subcomand rebalance information * README updated with subcomand rebalance information * README updated with subcommand rebalance information
1 parent 7002830 commit d1378c0

File tree

6 files changed

+509
-7
lines changed

6 files changed

+509
-7
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,18 @@ resource type in the cluster. Currently, the following operations are supported:
175175
| `get offsets [topic]` | Number of messages per partition along with start and end times |
176176
| `get topics` | All topics in the cluster |
177177

178+
#### rebalance
179+
180+
```
181+
topicctl rebalance [flags]
182+
```
183+
184+
The `apply` subcommand can be used with flag `--rebalance` rebalances a specified topics across a cluster.
185+
186+
The `rebalance` subcommand, on the other hand, performs a rebalance for **all** the topics defined at a given topic prefix path.
187+
188+
See the [rebalancing](#rebalancing) section below for more information on rebalancing.
189+
178190
#### repl
179191

180192
```
@@ -372,22 +384,33 @@ Note that these all try to achieve in-topic balance, and only vary in the case o
372384
Thus, the placements won't be significantly different in most cases.
373385

374386
In the future, we may add pickers that allow for some in-topic imbalance, e.g. to correct a
375-
cluster-wide broker inbalance.
387+
cluster-wide broker imbalance.
376388

377389
#### Rebalancing
378390

379-
If `apply` is run with the `--rebalance` flag set, then `topicctl` will do a full broker rebalance
391+
If `apply` is run with the `--rebalance` flag, then `topicctl` will rebalance specified topics
380392
after the usual apply steps. This process will check the balance of the brokers for each index
381-
position (i.e., first, second, third, etc.) in each partition and make replacements if there
393+
position (i.e., first, second, third, etc.) for each partition and make replacements if there
382394
are any brokers that are significantly over- or under-represented.
383395

384-
The rebalance process can optionally remove brokers from a topic too. To use this feature, set the
396+
The rebalance process can optionally remove brokers from a topic. To use this feature, set the
385397
`--to-remove` flag. Note that this flag has no effect unless `--rebalance` is also set.
386398

387399
Rebalancing is not done by default on all apply runs because it can be fairly disruptive and
388-
generally shouldn't be necessary unless the topic started off in an inbalanced state or there
400+
generally shouldn't be necessary unless the topic started off in an imbalanced state or there
389401
has been a change in the number of brokers.
390402

403+
To rebalance **all** topics in a cluster, use the `rebalance` subcommand, which will perform the `apply --rebalance`
404+
function on all qualifying topics. It will inventory all topic configs found at `--path-prefix` for a cluster
405+
specified by `--cluster-config`.
406+
407+
This subcommand will not rebalance a topic if:
408+
409+
1. the topic config is inconsistent with the cluster config (name, region, environment etc...)
410+
1. the partition count of a topic in the kafka cluster does not match the topic partition setting in the topic config
411+
1. a topic's `retention.ms` in the kafka cluster does not match the topic's `retentionMinutes` setting in the topic config
412+
1. a topic does not exist in the kafka cluster
413+
391414
## Tool safety
392415

393416
The `bootstrap`, `get`, `repl`, and `tail` subcommands are read-only and should never make

0 commit comments

Comments
 (0)