title | summary | aliases | ||
---|---|---|---|---|
PD Configuration File |
Learn the PD configuration file. |
|
The PD configuration file supports more options than command-line parameters. You can find the default configuration file here.
This document only describes parameters that are not included in command-line parameters. Check here for the command line parameters.
Tip:
If you need to adjust the value of a configuration item, refer to Modify the configuration.
- The unique name of a PD node
- Default value:
"pd"
- To start multiply PD nodes, use a unique name for each node.
- The directory in which PD stores data
- Default value:
default.${name}"
- The list of client URLs to be listened to by PD
- Default value:
"http://127.0.0.1:2379"
- When you deploy a cluster, you must specify the IP address of the current host as
client-urls
(for example,"http://192.168.100.113:2379"
). If the cluster runs on Docker, specify the IP address of Docker as"http://0.0.0.0:2379"
.
- The list of advertise URLs for the client to access PD
- Default value:
"${client-urls}"
- In some situations such as in the Docker or NAT network environment, if a client cannot access PD through the default client URLs listened to by PD, you must manually set the advertise client URLs.
- For example, the internal IP address of Docker is
172.17.0.1
, while the IP address of the host is192.168.100.113
and the port mapping is set to-p 2380:2380
. In this case, you can setadvertise-client-urls
to"http://192.168.100.113:2380"
. The client can find this service through"http://192.168.100.113:2380"
.
- The list of peer URLs to be listened to by a PD node
- Default value:
"http://127.0.0.1:2380"
- When you deploy a cluster, you must specify
peer-urls
as the IP address of the current host, such as"http://192.168.100.113:2380"
. If the cluster runs on Docker, specify the IP address of Docker as"http://0.0.0.0:2380"
.
- The list of advertise URLs for other PD nodes (peers) to access a PD node
- Default:
"${peer-urls}"
- In some situations such as in the Docker or NAT network environment, if the other nodes (peers) cannot access the PD node through the default peer URLs listened to by this PD node, you must manually set the advertise peer URLs.
- For example, the internal IP address of Docker is
172.17.0.1
, while the IP address of the host is192.168.100.113
and the port mapping is set to-p 2380:2380
. In this case, you can setadvertise-peer-urls
to"http://192.168.100.113:2380"
. The other PD nodes can find this service through"http://192.168.100.113:2380"
.
-
The initial cluster configuration for bootstrapping
-
Default value:
"{name}=http://{advertise-peer-url}"
-
For example, if
name
is "pd", andadvertise-peer-urls
is"http://192.168.100.113:2380"
, theinitial-cluster
is"pd=http://192.168.100.113:2380"
. -
If you need to start three PD servers, the
initial-cluster
might be:pd1=http://192.168.100.113:2380, pd2=http://192.168.100.114:2380, pd3=192.168.100.115:2380
- The initial state of the cluster
- Default value:
"new"
- Identifies different clusters during the bootstrap phase
- Default value:
"pd-cluster"
- If multiple clusters that have nodes with same configurations are deployed successively, you must specify different tokens to isolate different cluster nodes.
- The timeout of the PD Leader Key lease. After the timeout, the system re-elects a Leader.
- Default value:
3
- Unit: second
- The storage size of the meta-information database, which is 8GiB by default
- Default value:
8589934592
- The automatic compaction modes of the meta-information database
- Available options:
periodic
(by cycle) andrevision
(by version number). - Default value:
periodic
- The time interval for automatic compaction of the meta-information database when
auto-compaction-retention
isperiodic
. When the compaction mode is set torevision
, this parameter indicates the version number for the automatic compaction. - Default value: 1h
- Determines whether to force PD to start as a new cluster and modify the number of Raft members to
1
- Default value:
false
- The interval at which PD updates the physical time of TSO.
- In a default update interval of TSO physical time, PD provides at most 262144 TSOs. To get more TSOs, you can reduce the value of this configuration item. The minimum value is
1ms
. - Decreasing this configuration item might increase the CPU usage of PD. According to the test, compared with the interval of
50ms
, the CPU usage of PD will increase by about 10% when the interval is1ms
. - Default value:
50ms
- Minimum value:
1ms
Configuration items related to pd-server
Warning:
This configuration is an experimental feature. It is not recommended to use it in production environments.
- The memory limit ratio for a PD instance. The value
0
means no memory limit. - Default value:
0
- Minimum value:
0
- Maximum value:
0.99
Warning:
This configuration is an experimental feature. It is not recommended to use it in production environments.
- The threshold ratio at which PD tries to trigger GC. When the memory usage of PD reaches the value of
server-memory-limit
* the value ofserver-memory-limit-gc-trigger
, PD triggers a Golang GC. Only one GC is triggered in one minute. - Default value:
0.7
- Minimum value:
0.5
- Maximum value:
0.99
Warning:
This configuration is an experimental feature. It is not recommended to use it in production environments.
- Controls whether to enable the GOGC Tuner.
- Default value:
false
Warning:
This configuration is an experimental feature. It is not recommended to use it in production environments.
- The maximum memory threshold ratio for tuning GOGC. When the memory exceeds this threshold, i.e. the value of
server-memory-limit
* the value ofgc-tuner-threshold
, GOGC Tuner stops working. - Default value:
0.6
- Minimum value:
0
- Maximum value:
0.9
- Default value: 3
- PD rounds the lowest digits of the flow number, which reduces the update of statistics caused by the changes of the Region flow information. This configuration item is used to specify the number of lowest digits to round for the Region flow information. For example, the flow
100512
will be rounded to101000
because the default value is3
. This configuration replacestrace-region-flow
.
Note:
If you have upgraded your cluster from a TiDB 4.0 version to the current version, the behavior of
flow-round-by-digit
after the upgrading and the behavior oftrace-region-flow
before the upgrading are consistent by default. This means that if the value oftrace-region-flow
is false before the upgrading, the value offlow-round-by-digit
after the upgrading is 127; if the value oftrace-region-flow
istrue
before the upgrading, the value offlow-round-by-digit
after the upgrading is3
.
- Determines the interval at which the minimum resolved timestamp is persistent to the PD. If this value is set to
0
, it means that the persistence is disabled. - Default value: Before v6.3.0, the default value is
"0s"
. Starting from v6.3.0, the default value is"1s"
, which is the smallest positive value. - Minimum value:
0
- Unit: second
Note:
For clusters upgraded from v6.0.0~v6.2.0, the default value of
min-resolved-ts-persistence-interval
does not change after the upgrade, which means that it will remain"0s"
. To enable this feature, you need to manually change the value of this configuration item.
Configuration items related to security
- The path of the CA file
- Default value: ""
- The path of the Privacy Enhanced Mail (PEM) file that contains the X509 certificate
- Default value: ""
- The path of the PEM file that contains the X509 key
- Default value: ""
- Controls whether to enable log redaction in the PD log
- When you set the configuration value to
true
, user data is redacted in the PD log. - Default value:
false
Configuration items related to log
- Specifies the level of the output log
- Optional value:
"debug"
,"info"
,"warn"
,"error"
,"fatal"
- Default value:
"info"
- The log format
- Optional value:
"text"
,"json"
- Default value:
"text"
- Whether to disable the automatically generated timestamp in the log
- Default value:
false
Configuration items related to the log file
- The maximum size of a single log file. When this value is exceeded, the system automatically splits the log into several files.
- Default value:
300
- Unit: MiB
- Minimum value:
1
- The maximum number of days in which a log is kept
- If the configuration item is not set, or the value of it is set to the default value 0, PD does not clean log files.
- Default value:
0
- The maximum number of log files to keep
- If the configuration item is not set, or the value of it is set to the default value 0, PD keeps all log files.
- Default value:
0
Configuration items related to monitoring
- The interval at which monitoring metric data is pushed to Prometheus
- Default value:
15s
Configuration items related to scheduling
- Controls the size limit of
Region Merge
. When the Region size is greater than the specified value, PD does not merge the Region with the adjacent Regions. - Default value:
20
- Unit: MiB
- Specifies the upper limit of the
Region Merge
key. When the Region key is greater than the specified value, the PD does not merge the Region with its adjacent Regions. - Default value:
200000
- Controls the running frequency at which
replicaChecker
checks the health state of a Region. The smaller this value is, the fasterreplicaChecker
runs. Normally, you do not need to adjust this parameter. - Default value:
10ms
- Controls the time interval between the
split
andmerge
operations on the same Region. That means a newly split Region will not be merged for a while. - Default value:
1h
- Controls the maximum number of snapshots that a single store receives or sends at the same time. PD schedulers depend on this configuration to prevent the resources used for normal traffic from being preempted.
- Default value value:
64
- Controls the maximum number of pending peers in a single store. PD schedulers depend on this configuration to prevent too many Regions with outdated logs from being generated on some nodes.
- Default value:
64
- The downtime after which PD judges that the disconnected store cannot be recovered. When PD fails to receive the heartbeat from a store after the specified period of time, it adds replicas at other nodes.
- Default value:
30m
- Controls the maximum waiting time for the store to go online. During the online stage of a store, PD can query the online progress of the store. When the specified time is exceeded, PD assumes that the store has been online and cannot query the online progress of the store again. But this does not prevent Regions from transferring to the new online store. In most scenarios, you do not need to adjust this parameter.
- Default value:
48h
- The number of Leader scheduling tasks performed at the same time
- Default value:
4
- The number of Region scheduling tasks performed at the same time
- Default value:
2048
- Controls whether to enable the diagnostic feature. When it is enabled, PD records the state during scheduling to help diagnose. If enabled, it might slightly affect the scheduling speed and consume more memory when there are many stores.
- Default value: Starting from v7.1.0, the default value is changed from
false
totrue
. If your cluster is upgraded from a version earlier than v7.1.0 to v7.1.0 or later, the default value does not change.
- Controls the hot Region scheduling tasks that are running at the same time. It is independent of the Region scheduling.
- Default value:
4
- The threshold used to set the number of minutes required to identify a hot Region. PD can participate in the hotspot scheduling only after the Region is in the hotspot state for more than this number of minutes.
- Default value:
3
- The number of Replica scheduling tasks performed at the same time
- Default value:
64
- The number of the
Region Merge
scheduling tasks performed at the same time. Set this parameter to0
to disableRegion Merge
. - Default value:
8
- The threshold ratio below which the capacity of the store is sufficient. If the space occupancy ratio of the store is smaller than this threshold value, PD ignores the remaining space of the store when performing scheduling, and balances load mainly based on the Region size. This configuration takes effect only when
region-score-formula-version
is set tov1
. - Default value:
0.7
- Minimum value: greater than
0
- Maximum value: less than
1
- The threshold ratio above which the capacity of the store is insufficient. If the space occupancy ratio of a store exceeds this threshold value, PD avoids migrating data to this store as much as possible. Meanwhile, to avoid the disk space of the corresponding store being exhausted, PD performs scheduling mainly based on the remaining space of the store.
- Default value:
0.8
- Minimum value: greater than
0
- Maximum value: less than
1
- Controls the
balance
buffer size - Default value:
0
(automatically adjusts the buffer size) - Minimum value:
0
- Determines whether to enable the merging of cross-table Regions
- Default value:
true
- Controls the version of the Region score formula
- Default value:
v2
- Optional values:
v1
andv2
. Compared to v1, the changes in v2 are smoother, and the scheduling jitter caused by space reclaim is improved.
Note:
If you have upgraded your cluster from a TiDB 4.0 version to the current version, the new formula version is automatically disabled by default to ensure consistent PD behavior before and after the upgrading. If you want to change the formula version, you need to manually switch through the
pd-ctl
setting. For details, refer to PD Control.
Warning:
Setting this configuration item to
"v2"
is an experimental feature. It is not recommended to use it in production environments.
- Controls the version of the store limit formula
- Default value:
v1
- Value options:
v1
: In v1 mode, you can manually modify thestore limit
to limit the scheduling speed of a single TiKV.v2
: (experimental feature) In v2 mode, you do not need to manually set thestore limit
value, as PD dynamically adjusts it based on the capability of TiKV snapshots. For more details, refer to Principles of store limit v2.
- Controls whether to use Joint Consensus for replica scheduling. If this configuration is disabled, PD schedules one replica at a time.
- Default value:
true
- The time interval at which PD stores hot Region information.
- Default value:
10m
Note:
The information about hot Regions is updated every three minutes. If the interval is set to less than three minutes, updates during the interval might be meaningless.
- Specifies how many days the hot Region information is retained.
- Default value:
7
Configuration items related to replicas
- The number of replicas, that is, the sum of the number of leaders and followers. The default value
3
means 1 leader and 2 followers. When this configuration is modified dynamically, PD will schedule Regions in the background so that the number of replicas matches this configuration. - Default value:
3
- The topology information of a TiKV cluster
- Default value:
[]
- Cluster topology configuration
- The minimum topological isolation level of a TiKV cluster
- Default value:
""
- Cluster topology configuration
- Enables the strict check for whether the TiKV label matches PD's
location-labels
. - Default value:
false
- Enables
placement-rules
. - Default value:
true
- See Placement Rules.
Configuration items related to labels
- The label key for the store that rejected the Leader
- Default value:
""
- The label value for the store that rejected the Leader
- Default value:
""
Configuration items related to the TiDB Dashboard built in PD.
- The path of the root CA certificate file. You can configure this path when you connect to TiDB's SQL services using TLS.
- Default value:
""
- The path of the SSL certificate file. You can configure this path when you connect to TiDB's SQL services using TLS.
- Default value:
""
- The path of the SSL private key file. You can configure this path when you connect to TiDB's SQL services using TLS.
- Default value:
""
- When TiDB Dashboard is accessed behind a reverse proxy, this item sets the public URL path prefix for all web resources.
- Default value:
/dashboard
- Do not modify this configuration item when TiDB Dashboard is accessed not behind a reverse proxy; otherwise, access issues might occur. See Use TiDB Dashboard behind a Reverse Proxy for details.
- Determines whether to enable the telemetry collection feature in TiDB Dashboard.
- Default value:
false
- See Telemetry for details.
Configuration items related to the replication mode of all Regions. See Enable the DR Auto-Sync mode for details.
This section describes the configuration items that are built into PD for Resource Control.
- Time to wait to trigger the degradation mode. Degradation mode means that when the Local Token Bucket (LTB) and Global Token Bucket (GTB) are lost, the LTB falls back to the default resource group configuration and no longer has a GTB authorization token, thus ensuring that the service is not affected in the event of network isolation or anomalies.
- Default value: 0s
- The degradation mode is disabled by default.
The following are the configuration items about the Request Unit (RU).
- Basis factor for conversion from a read request to RU
- Default value: 0.25
- Basis factor for conversion from a write request to RU
- Default value: 1
- Basis factor for conversion from read flow to RU
- Default value: 1/(64 * 1024)
- 1 RU = 64 KiB read bytes
- Basis factor for conversion from write flow to RU
- Default value: 1/1024
- 1 RU = 1 KiB write bytes
- Basis factor for conversion from CPU to RU
- Default value: 1/3
- 1 RU = 3 millisecond CPU time