- Docs Home
- About TiDB
- Quick Start
- Develop
- Overview
- Quick Start
- Build a TiDB Cluster in TiDB Cloud (Developer Tier)
- CRUD SQL in TiDB
- Build a Simple CRUD App with TiDB
- Example Applications
- Connect to TiDB
- Design Database Schema
- Write Data
- Read Data
- Transaction
- Optimize
- Troubleshoot
- Reference
- Cloud Native Development Environment
- Third-party Support
- Deploy
- Software and Hardware Requirements
- Environment Configuration Checklist
- Plan Cluster Topology
- Install and Start
- Verify Cluster Status
- Test Cluster Performance
- Migrate
- Overview
- Migration Tools
- Migration Scenarios
- Migrate from Aurora
- Migrate MySQL of Small Datasets
- Migrate MySQL of Large Datasets
- Migrate and Merge MySQL Shards of Small Datasets
- Migrate and Merge MySQL Shards of Large Datasets
- Migrate from CSV Files
- Migrate from SQL Files
- Migrate from One TiDB Cluster to Another TiDB Cluster
- Migrate from TiDB to MySQL-compatible Databases
- Advanced Migration
- Integrate
- Overview
- Integration Scenarios
- Maintain
- Monitor and Alert
- Troubleshoot
- TiDB Troubleshooting Map
- Identify Slow Queries
- Analyze Slow Queries
- SQL Diagnostics
- Identify Expensive Queries Using Top SQL
- Identify Expensive Queries Using Logs
- Statement Summary Tables
- Troubleshoot Hotspot Issues
- Troubleshoot Increased Read and Write Latency
- Save and Restore the On-Site Information of a Cluster
- Troubleshoot Cluster Setup
- Troubleshoot High Disk I/O Usage
- Troubleshoot Lock Conflicts
- Troubleshoot TiFlash
- Troubleshoot Write Conflicts in Optimistic Transactions
- Troubleshoot Inconsistency Between Data and Indexes
- Performance Tuning
- Tuning Guide
- Configuration Tuning
- System Tuning
- Software Tuning
- SQL Tuning
- Overview
- Understanding the Query Execution Plan
- SQL Optimization Process
- Overview
- Logic Optimization
- Physical Optimization
- Prepare Execution Plan Cache
- Control Execution Plans
- Tutorials
- TiDB Tools
- Overview
- Use Cases
- Download
- TiUP
- Documentation Map
- Overview
- Terminology and Concepts
- Manage TiUP Components
- FAQ
- Troubleshooting Guide
- Command Reference
- Overview
- TiUP Commands
- TiUP Cluster Commands
- Overview
- tiup cluster audit
- tiup cluster check
- tiup cluster clean
- tiup cluster deploy
- tiup cluster destroy
- tiup cluster disable
- tiup cluster display
- tiup cluster edit-config
- tiup cluster enable
- tiup cluster help
- tiup cluster import
- tiup cluster list
- tiup cluster patch
- tiup cluster prune
- tiup cluster reload
- tiup cluster rename
- tiup cluster replay
- tiup cluster restart
- tiup cluster scale-in
- tiup cluster scale-out
- tiup cluster start
- tiup cluster stop
- tiup cluster template
- tiup cluster upgrade
- TiUP DM Commands
- Overview
- tiup dm audit
- tiup dm deploy
- tiup dm destroy
- tiup dm disable
- tiup dm display
- tiup dm edit-config
- tiup dm enable
- tiup dm help
- tiup dm import
- tiup dm list
- tiup dm patch
- tiup dm prune
- tiup dm reload
- tiup dm replay
- tiup dm restart
- tiup dm scale-in
- tiup dm scale-out
- tiup dm start
- tiup dm stop
- tiup dm template
- tiup dm upgrade
- TiDB Cluster Topology Reference
- DM Cluster Topology Reference
- Mirror Reference Guide
- TiUP Components
- PingCAP Clinic Diagnostic Service
- TiDB Operator
- Dumpling
- TiDB Lightning
- TiDB Data Migration
- About TiDB Data Migration
- Architecture
- Quick Start
- Deploy a DM cluster
- Tutorials
- Advanced Tutorials
- Maintain
- Cluster Upgrade
- Tools
- Performance Tuning
- Manage Data Sources
- Manage Tasks
- Export and Import Data Sources and Task Configurations of Clusters
- Handle Alerts
- Daily Check
- Reference
- Architecture
- Command Line
- Configuration Files
- OpenAPI
- Compatibility Catalog
- Secure
- Monitoring and Alerts
- Error Codes
- Glossary
- Example
- Troubleshoot
- Release Notes
- Backup & Restore (BR)
- Point-in-Time Recovery
- TiDB Binlog
- TiCDC
- Dumpling
- sync-diff-inspector
- TiSpark
- Reference
- Cluster Architecture
- Key Monitoring Metrics
- Secure
- Privileges
- SQL
- SQL Language Structure and Syntax
- SQL Statements
ADD COLUMN
ADD INDEX
ADMIN
ADMIN CANCEL DDL
ADMIN CHECKSUM TABLE
ADMIN CHECK [TABLE|INDEX]
ADMIN SHOW DDL [JOBS|QUERIES]
ADMIN SHOW TELEMETRY
ALTER DATABASE
ALTER INDEX
ALTER INSTANCE
ALTER PLACEMENT POLICY
ALTER TABLE
ALTER TABLE COMPACT
ALTER TABLE SET TIFLASH MODE
ALTER USER
ANALYZE TABLE
BACKUP
BATCH
BEGIN
CHANGE COLUMN
COMMIT
CHANGE DRAINER
CHANGE PUMP
CREATE [GLOBAL|SESSION] BINDING
CREATE DATABASE
CREATE INDEX
CREATE PLACEMENT POLICY
CREATE ROLE
CREATE SEQUENCE
CREATE TABLE LIKE
CREATE TABLE
CREATE USER
CREATE VIEW
DEALLOCATE
DELETE
DESC
DESCRIBE
DO
DROP [GLOBAL|SESSION] BINDING
DROP COLUMN
DROP DATABASE
DROP INDEX
DROP PLACEMENT POLICY
DROP ROLE
DROP SEQUENCE
DROP STATS
DROP TABLE
DROP USER
DROP VIEW
EXECUTE
EXPLAIN ANALYZE
EXPLAIN
FLASHBACK TABLE
FLUSH PRIVILEGES
FLUSH STATUS
FLUSH TABLES
GRANT <privileges>
GRANT <role>
INSERT
KILL [TIDB]
LOAD DATA
LOAD STATS
MODIFY COLUMN
PREPARE
RECOVER TABLE
RENAME INDEX
RENAME TABLE
REPLACE
RESTORE
REVOKE <privileges>
REVOKE <role>
ROLLBACK
SAVEPOINT
SELECT
SET DEFAULT ROLE
SET [NAMES|CHARACTER SET]
SET PASSWORD
SET ROLE
SET TRANSACTION
SET [GLOBAL|SESSION] <variable>
SHOW ANALYZE STATUS
SHOW [BACKUPS|RESTORES]
SHOW [GLOBAL|SESSION] BINDINGS
SHOW BUILTINS
SHOW CHARACTER SET
SHOW COLLATION
SHOW [FULL] COLUMNS FROM
SHOW CONFIG
SHOW CREATE PLACEMENT POLICY
SHOW CREATE SEQUENCE
SHOW CREATE TABLE
SHOW CREATE USER
SHOW DATABASES
SHOW DRAINER STATUS
SHOW ENGINES
SHOW ERRORS
SHOW [FULL] FIELDS FROM
SHOW GRANTS
SHOW INDEX [FROM|IN]
SHOW INDEXES [FROM|IN]
SHOW KEYS [FROM|IN]
SHOW MASTER STATUS
SHOW PLACEMENT
SHOW PLACEMENT FOR
SHOW PLACEMENT LABELS
SHOW PLUGINS
SHOW PRIVILEGES
SHOW [FULL] PROCESSSLIST
SHOW PROFILES
SHOW PUMP STATUS
SHOW SCHEMAS
SHOW STATS_HEALTHY
SHOW STATS_HISTOGRAMS
SHOW STATS_META
SHOW STATUS
SHOW TABLE NEXT_ROW_ID
SHOW TABLE REGIONS
SHOW TABLE STATUS
SHOW [FULL] TABLES
SHOW [GLOBAL|SESSION] VARIABLES
SHOW WARNINGS
SHUTDOWN
SPLIT REGION
START TRANSACTION
TABLE
TRACE
TRUNCATE
UPDATE
USE
WITH
- Data Types
- Functions and Operators
- Overview
- Type Conversion in Expression Evaluation
- Operators
- Control Flow Functions
- String Functions
- Numeric Functions and Operators
- Date and Time Functions
- Bit Functions and Operators
- Cast Functions and Operators
- Encryption and Compression Functions
- Locking Functions
- Information Functions
- JSON Functions
- Aggregate (GROUP BY) Functions
- Window Functions
- Miscellaneous Functions
- Precision Math
- Set Operations
- List of Expressions for Pushdown
- TiDB Specific Functions
- Clustered Indexes
- Constraints
- Generated Columns
- SQL Mode
- Table Attributes
- Transactions
- Garbage Collection (GC)
- Views
- Partitioning
- Temporary Tables
- Cached Tables
- Character Set and Collation
- Placement Rules in SQL
- System Tables
mysql
- INFORMATION_SCHEMA
- Overview
ANALYZE_STATUS
CLIENT_ERRORS_SUMMARY_BY_HOST
CLIENT_ERRORS_SUMMARY_BY_USER
CLIENT_ERRORS_SUMMARY_GLOBAL
CHARACTER_SETS
CLUSTER_CONFIG
CLUSTER_HARDWARE
CLUSTER_INFO
CLUSTER_LOAD
CLUSTER_LOG
CLUSTER_SYSTEMINFO
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
DATA_LOCK_WAITS
DDL_JOBS
DEADLOCKS
ENGINES
INSPECTION_RESULT
INSPECTION_RULES
INSPECTION_SUMMARY
KEY_COLUMN_USAGE
METRICS_SUMMARY
METRICS_TABLES
PARTITIONS
PLACEMENT_POLICIES
PROCESSLIST
REFERENTIAL_CONSTRAINTS
SCHEMATA
SEQUENCES
SESSION_VARIABLES
SLOW_QUERY
STATISTICS
TABLES
TABLE_CONSTRAINTS
TABLE_STORAGE_STATS
TIDB_HOT_REGIONS
TIDB_HOT_REGIONS_HISTORY
TIDB_INDEXES
TIDB_SERVERS_INFO
TIDB_TRX
TIFLASH_REPLICA
TIKV_REGION_PEERS
TIKV_REGION_STATUS
TIKV_STORE_STATUS
USER_PRIVILEGES
VARIABLES_INFO
VIEWS
METRICS_SCHEMA
- UI
- TiDB Dashboard
- Overview
- Maintain
- Access
- Overview Page
- Cluster Info Page
- Top SQL Page
- Key Visualizer Page
- Metrics Relation Graph
- SQL Statements Analysis
- Slow Queries Page
- Cluster Diagnostics
- Monitoring Page
- Search Logs Page
- Instance Profiling
- Session Management and Configuration
- FAQ
- CLI
- Command Line Flags
- Configuration File Parameters
- System Variables
- Storage Engines
- Telemetry
- Errors Codes
- Table Filter
- Schedule Replicas by Topology Labels
- FAQs
- Release Notes
- All Releases
- Release Timeline
- TiDB Versioning
- TiDB Installation Packages
- v6.2
- v6.1
- v6.0
- v5.4
- v5.3
- v5.2
- v5.1
- v5.0
- v4.0
- v3.1
- v3.0
- v2.1
- v2.0
- v1.0
- Glossary
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.
name
- The unique name of a PD node
- Default value:
"pd"
- To start multiply PD nodes, use a unique name for each node.
data-dir
- The directory in which PD stores data
- Default value:
default.${name}"
client-urls
- 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"
.
advertise-client-urls
- 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"
.
peer-urls
- 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"
.
advertise-peer-urls
- 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"
.
initial-cluster
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
initial-cluster-state
- The initial state of the cluster
- Default value:
"new"
initial-cluster-token
- 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.
lease
- The timeout of the PD Leader Key lease. After the timeout, the system re-elects a Leader.
- Default value:
3
- Unit: second
quota-backend-bytes
- The storage size of the meta-information database, which is 8GiB by default
- Default value:
8589934592
auto-compaction-mod
- The automatic compaction modes of the meta-information database
- Available options:
periodic
(by cycle) andrevision
(by version number). - Default value:
periodic
auto-compaction-retention
- 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
force-new-cluster
- Determines whether to force PD to start as a new cluster and modify the number of Raft members to
1
- Default value:
false
security
Configuration items related to security
cacert-path
- The path of the CA file
- Default value: ""
cert-path
- The path of the Privacy Enhanced Mail (PEM) file that contains the X509 certificate
- Default value: ""
key-path
- The path of the PEM file that contains the X509 key
- Default value: ""
redact-info-log
New in v5.0
- 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
log
Configuration items related to log
level
- Specifies the level of the output log
- Optional value:
"debug"
,"info"
,"warn"
,"error"
,"fatal"
- Default value:
"info"
format
- The log format
- Optional value:
"text"
,"json"
- Default value:
"text"
disable-timestamp
- Whether to disable the automatically generated timestamp in the log
- Default value:
false
log.file
Configuration items related to the log file
max-size
- 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
max-days
- 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
max-backups
- 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
metric
Configuration items related to monitoring
interval
- The interval at which monitoring metric data is pushed to Prometheus
- Default value:
15s
schedule
Configuration items related to scheduling
max-merge-region-size
- 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
max-merge-region-keys
- 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
patrol-region-interval
- 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
split-merge-interval
- 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
max-snapshot-count
- 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
max-pending-peer-count
- 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
max-store-down-time
- The downtime after which PD judges that the disconnected store can not 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
max-store-preparing-time
New in v6.1.0
- 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
leader-schedule-limit
- The number of Leader scheduling tasks performed at the same time
- Default value:
4
region-schedule-limit
- The number of Region scheduling tasks performed at the same time
- Default value:
2048
hot-region-schedule-limit
- Controls the hot Region scheduling tasks that are running at the same time. It is independent of the Region scheduling.
- Default value:
4
hot-region-cache-hits-threshold
- 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
replica-schedule-limit
- The number of Replica scheduling tasks performed at the same time
- Default value:
64
merge-schedule-limit
- The number of the
Region Merge
scheduling tasks performed at the same time. Set this parameter to0
to disableRegion Merge
. - Default value:
8
high-space-ratio
- 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
low-space-ratio
- 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
tolerant-size-ratio
- Controls the
balance
buffer size - Default value:
0
(automatically adjusts the buffer size) - Minimum value:
0
enable-cross-table-merge
- Determines whether to enable the merging of cross-table Regions
- Default value:
true
region-score-formula-version
New in v5.0
- 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.
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.
enable-joint-consensus
New in v5.0
- Controls whether to use Joint Consensus for replica scheduling. If this configuration is disabled, PD schedules one replica at a time.
- Default value:
true
hot-regions-write-interval
New in v5.4.0
- The time interval at which PD stores hot Region information.
- Default value:
10m
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.
hot-regions-reserved-days
New in v5.4.0
- Specifies how many days the hot Region information is retained.
- Default value:
7
replication
Configuration items related to replicas
max-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 online, PD will schedule Regions in the background so that the number of replicas matches this configuration. - Default value:
3
location-labels
- The topology information of a TiKV cluster
- Default value:
[]
- Cluster topology configuration
isolation-level
- The minimum topological isolation level of a TiKV cluster
- Default value:
""
- Cluster topology configuration
strictly-match-label
- Enables the strict check for whether the TiKV label matches PD's
location-labels
. - Default value:
false
enable-placement-rules
- Enables
placement-rules
. - Default value:
false
- See Placement Rules.
- An experimental feature of TiDB 4.0.
flow-round-by-digit
New in TiDB 5.1
- 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
.
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 of trace-region-flow
before the upgrading are consistent by default. This means that if the value of trace-region-flow
is false before the upgrading, the value of flow-round-by-digit
after the upgrading is 127; if the value of trace-region-flow
is true
before the upgrading, the value of flow-round-by-digit
after the upgrading is 3
.
label-property
Configuration items related to labels
key
- The label key for the store that rejected the Leader
- Default value:
""
value
- The label value for the store that rejected the Leader
- Default value:
""
dashboard
Configuration items related to the TiDB Dashboard built in PD.
tidb-cacert-path
- 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:
""
tidb-cert-path
- The path of the SSL certificate file. You can configure this path when you connect to TiDB's SQL services using TLS.
- Default value:
""
tidb-key-path
- 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:
""
public-path-prefix
- 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.
enable-telemetry
- Determines whether to enable the telemetry collection feature in TiDB Dashboard.
- Default value:
true
- See Telemetry for details.
replication-mode
Configuration items related to the replication mode of all Regions. See Enable the DR Auto-Sync mode for details.
- security
- log
- log.file
- metric
- schedule
- max-merge-region-size
- max-merge-region-keys
- patrol-region-interval
- split-merge-interval
- max-snapshot-count
- max-pending-peer-count
- max-store-down-time
- max-store-preparing-time
- leader-schedule-limit
- region-schedule-limit
- hot-region-schedule-limit
- hot-region-cache-hits-threshold
- replica-schedule-limit
- merge-schedule-limit
- high-space-ratio
- low-space-ratio
- tolerant-size-ratio
- enable-cross-table-merge
- region-score-formula-version
- enable-joint-consensus
- hot-regions-write-interval
- hot-regions-reserved-days
- replication
- label-property
- dashboard
- replication-mode