Status
Current state: UNDER DISCUSSION
...
JIRA: KAFKA-5319
Released:
Motivation
I want to add a tool to make amounts of replicas and leaders on every brokers balanced.Current kafka server does not provide a function to make cluster balance.When we use console command to create a topic without 'replicaAssignmentOpt' ,kafka server assigns replicas by a "replicaAssignment" function . The function spread the replicas evenly among brokers to make cluster balanced.It can not make sure the cluster is balanced.Even though it is balanced,the balanced state will be destroyed.Example:
...
So it is necessary to add to add a tool to deal with replica and leader balance.
Proposed Changes
We use an algorithm to get a balanced assignment of replicas or leaders,and call ReassignPartitionsCommand to let kafka sever move replicas or change the position of replicas in ARs.
...
show-cluster-state This command print out current cluster balance state.We can use it to learn whether or not the cluster need to be balanced
leader-balance This command let amounts of leaders of every brokers make balanced
replica-rebalance This command let amounts of replicas and leaders of every brokers make balanced
Public Interfaces
Compatibility, Deprecation, and Migration Plan
Rejected Alternatives
We can also use ReassignPartitionsCommand to move replicas to make replica balance and change the first replica in ARs to make leader balance by manual operation.However it will become more and more difficult with topic and broker increasing.
...