How to Check the Priority of PD Leader Election

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

Original topic: 如何查看pd 选举leader的优先级

| username: TiDBer_yyy

[Test Environment for TiDB]
[TiDB Version] 7.1.0

[Encountered Issue: Problem Description and Impact]
By setting leader_priority, how to view the priority of all PD nodes

tiup ctl:v7.1.0 pd --pd= member leader_priority pd- 4
| username: TiDBer_yyy | Original post link

You can directly check it with pdcel member. The priority setting will be displayed if it has been configured; if not, there will be no such configuration.

| username: TiDBer_yyy | Original post link

The question is, what is the default leader_priority?

| username: Prest13 | Original post link

My impression is that the default is 1.

| username: TiDBer_yyy | Original post link

When I retested, setting the priority=0 was the same as not configuring it. You can try it.

tiup ctl:v7.1.0 pd --pd= member leader_priority pd- 0
| username: TiDBer_QYr0vohO | Original post link

tiup ctl:v{version} pd member

| username: Kongdom | Original post link

It seems like you can only see it after setting it up :thinking:

| username: jiayou64 | Original post link

If the priority of the TiDB PD component is not set by default, checking the member will show no “leader_priority” parameter. The priority values should all be 0. The command to specify the PD leader’s priority is shown in the image. The higher the priority value, the more likely the node will become the leader. I tested it, and it works.

» member leader_priority pd- 3

After resetting the priority, it reverted back.

» member leader_priority pd- 0

Additionally, even if the leader is transferred to another specified member, it will eventually migrate to the node with the highest priority value.

» member leader transfer pd-
| username: TiDBer_yyy | Original post link

Yes, I tested it offline myself and it was the same.

| username: yytest | Original post link

Check the configuration file of the PD node, or use the command line tool pd-ctl provided by PD to query.