The open source TiDB platform released under the Apache 2.0 license, and supported by the community
Select your favorite way to deploy TiDB online
Deploy TiDB on bare-metal using TiUP
TiUP is a cluster operation and maintenance tool that makes it easy to deploy TiDB clusters. The following commands will deploy a simple local cluster using TiUP’s “playground” component. Refer to the TiUP documentation for more information about how to use TiUP to deploy a cluster across multiple hosts.
1. Deploy TiDB
tiup playground
2. Access TiDB
mysql --host 127.0.0.1 --port 4000 -u root
Deploy TiDB on Kubernetes
TiDB can be easily deployed in a Kubernetes environment using TiDB Operator. These commands will install the TiDB Operator CRDs into an existing Kubernetes cluster and deploy a basic TiDB cluster. Refer to the TiDB Operator documentation for more information about how to customize a deployment.
1. Install TiDB Operator
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/{tidb-operator version}/manifests/crd.yaml
helm repo add pingcap https://charts.pingcap.org/
helm install tidb-operator pingcap/tidb-operator --version {tidb-operator version}
2. Deploy TiDB and TiDB Monitor
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic/tidb-cluster.yaml
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic/tidb-monitor.yaml
3. Access the database
kubectl port-forward svc/basic-tidb 4000 > pf4000.out &
mysql -h 127.0.0.1 -P 4000 -u root
Deploy TiDB on AWS EKS
TiDB can be easily deployed to AWS EKS using TiDB Operator and included Terraform scripts to manage EKS infrastructure. These commands will create a basic EKS cluster, install TiDB Operator, and deploy a basic TiDB cluster. Consult the TiDB Operator documentation for more information about how to customize your deployment.
1. Deploy EKS, TiDB Operator, and TiDB cluster node pool
git clone --depth=1 https://github.com/pingcap/tidb-operator && cd tidb-operator/deploy/aws
cp demo.tfvars terraform.tfvars
terraform init
terraform apply
2. Deploy TiDB cluster and monitor
sed "s/CLUSTER_NAME/${cluster_name}/g" manifests/db.yaml.example > db.yaml
sed "s/CLUSTER_NAME/${cluster_name}/g" manifests/db-monitor.yaml.example > db-monitor.yaml
kubectl --kubeconfig credentials/kubeconfig_${eks_name} create -f db.yaml
kubectl --kubeconfig credentials/kubeconfig_${eks_name} create -f db-monitor.yaml
3. Access the database
ssh -i credentials/${eks_name}.pem centos@${bastion_ip}
mysql -h ${tidb_lb} -P 4000 -u root
Deploy TiDB on GCP GKE
TiDB can be easily deployed to GCP GKE using TiDB Operator and included Terraform scripts to manage GKE infrastructure. These commands will create a basic GKE cluster, install TiDB Operator, and deploy a basic TiDB cluster. Consult the TiDB Operator documentation for more information about how to customize your deployment.
1. Deploy GKE, TiDB Operator, and TiDB cluster node pool
git clone --depth=1 https://github.com/pingcap/tidb-operator && cd tidb-operator/deploy/gcp
cat small.tfvars >> terraform.tfvars
terraform init
terraform apply
2. Deploy TiDB cluster and monitor
sed "s/CLUSTER_NAME/tidb-cluster/g" manifests/db.yaml.example > db.yaml
sed "s/CLUSTER_NAME/tidb-cluster/g" manifests/db-monitor.yaml.example > db-monitor.yaml
kubectl --kubeconfig credentials/kubeconfig_${gke_name} create -f db.yaml
kubectl --kubeconfig credentials/kubeconfig_${gke_name} create -f db-monitor.yaml
3. Access the database
gcloud compute ssh ${gke_cluster_name}-bastion --zone ${zone}
mysql -h ${tidb_lb} -P 4000 -u root