TiDB is designed for horizontal scaling. TiDB server nodes are stateless and can be added at any time. TiKV and TiFlash nodes are added by the operator or TiUP, and PD automatically rebalances data across nodes. Scaling operations do not require downtime.
Component scaling overview
TiKV rebalancing runs in the background and may take time proportional to the amount of data being moved. Monitor region scheduling in TiDB Dashboard during the operation.
Horizontal scaling
Scale out with TiUP
Create a topology file describing the nodes to add. For example, to add a TiDB node:Then run:To add a TiKV node:To add a TiFlash node for columnar analytics:Verify the new nodes are online:Scale out with Kubernetes
TiDB on Kubernetes is managed via the TidbCluster custom resource. Edit the replica count for the component you want to scale.Scale TiDB server nodes:Scale TiKV nodes:Scale TiFlash nodes:Monitor rollout status:
Load balancer configuration
TiDB server nodes are stateless and interchangeable. Place a load balancer in front of them and route MySQL traffic to port 4000.
Example HAProxy configuration:
Vertical scaling
Vertical scaling means increasing CPU or memory on existing nodes. For TiUP deployments, this requires a rolling restart.
Update the cluster topology
Edit the cluster configuration to reflect the new resource limits: Reload the configuration
Apply the changes with a rolling restart:
On Kubernetes, update the resource requests and limits in the TidbCluster CR:
Scale in (remove nodes)
To remove nodes with TiUP:
Before scaling in TiKV nodes, ensure that the remaining nodes have sufficient capacity for the data that will be migrated. PD must complete region evacuation before the node is removed. This can take significant time for large datasets.