Placement Driver (PD)
PD (Placement Driver) is the metadata management and scheduling component for the entire TiDB cluster. PD acts as the "brain" that orchestrates data distribution and scheduling.
Key Functions of PD
1. Metadata Management
PD stores information about:
- The location of every Region on each TiKV node
- The cluster topology (who is connected to whom)
- The cluster configuration
2. Timestamp Oracle (TSO)
PD provides a unique global timestamp for every transaction. Each transaction gets a start timestamp and a commit timestamp from PD. This ensures snapshot isolation across the distributed cluster.
3. Region Scheduling
PD actively schedules Regions to:
- Load Balancing — move Regions from overloaded nodes to underutilized nodes
- Split Region — split Regions that have grown too large
- Merge Region — merge Regions that are too small
- Replica Management — add or remove replicas
4. TiDB Dashboard
PD provides the TiDB Dashboard, a web UI for cluster monitoring and management.
High Availability PD
PD runs on at least 3 nodes and uses the Raft protocol for consistency. For production, an odd number of nodes (3, 5, 7) is recommended so that a Raft quorum can be formed.
PD Cluster (3 nodes)
┌──────────┐ ┌──────────┐ ┌──────────┐
│ PD Node 1│──│ PD Node 2│──│ PD Node 3│
│ (Leader) │ │(Follower)│ │(Follower)│
└──────────┘ └──────────┘ └──────────┘
Key PD Configuration
[pd]
# Minimum Region size (default 96MB)
region-split-size = "96MB"
# Threshold before a Region is split
region-max-size = "256MB"
# Minimum size before a Region is merged
region-max-merge-size = "96MB"
Monitoring PD
Use the TiDB Dashboard or Grafana to monitor:
- Cluster Status — node count, health status
- Region Health — Region distribution, replica status
- Hot Regions — frequently accessed Regions
- Operators — scheduling operations currently running
In the next chapter, we will learn how to install TiDB.