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
部署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 theTiUP documentationfor 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
部署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
部署TiDB on AWS EKS
TiDB可以轻松地部署到使用TiDB AWS的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
部署TiDB on Google Cloud GKE
TiDB可以轻松地部署到谷歌云GKE我们ing 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