How to redistribute leaders after using pd-ctl to execute scheduler add evict-leader-scheduler 1

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 使用pd-ctl执行scheduler add evict-leader-scheduler 1后,如果想重新分布leader该如何操作

| username: terry0219

[TiDB Usage Environment] Production Environment
[TiDB Version] v6.5
[Encountered Problem: Problem Phenomenon and Impact]
After using pd-ctl to execute scheduler add evict-leader-scheduler 1, how can I rebalance the distribution of leaders?

| username: h5n1 | Original post link

What does rebalancing mean? Will the node still be needed after eviction? If needed, removing the evict scheduler with pd-ctl will schedule back to that node.

| username: terry0219 | Original post link

I tried it and it works, thank you.

| username: terry0219 | Original post link

Additionally, may I ask how to schedule all leaders to one node?

| username: h5n1 | Original post link

You can add evict leader scheduling on other nodes.

| username: terry0219 | Original post link

Got it, thanks!

| username: ljluestc | Original post link

After adding the evict-leader-scheduler, you can use the balance-leader command to rebalance the leader distribution.

You can use the following command to rebalance the leader distribution:

pd-ctl balance-leader [--cluster=<cluster_id>] [--region=<region_id>] [--limit=<limit>]

–cluster: Optional. Specifies the cluster ID. If not provided, it defaults to the ID of the cluster connected to the PD server.
–region: Optional. Specifies the region ID. If provided, only the leaders of the specified region will be balanced.
–limit: Optional. Specifies the maximum number of leaders to move. If not provided, it defaults to 16.

This command will attempt to balance the leaders within the specified limit by transferring leaders from heavily loaded TiKV instances to lightly loaded instances.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.