Lesson01 TiDB Cluster Deployment

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Lesson01 tidb cluster 部署

| username: huanglao2002

Lesson01 TiDB Cluster Deployment

1.1 Environment Preparation

For hardware and software requirements, see

1.2 Deployment

  1. Download and install TiUP.
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
  1. Declare environment variables
source ${your_shell_profile}
source /root/.bash_profile
  1. Start the test environment
tiup playground
tiup playground v7.5.0 --db 2 --pd 3 --kv 3
  1. Connect to the database
    Open a new session to access the TiDB database.
    Use TiUP client to connect to TiDB:
tiup client

You can also use the MySQL client to connect to TiDB:

mysql --host 127.0.0.1 --port 4000 -u root
  1. Clean up the cluster
tiup clean --all

1.2.2 Other Deployment Methods

tiup cluster template > topology.yaml
tiup cluster check ./topology.yaml --user root -p
tiup cluster check ./topology.yaml --apply --user root -p
tiup cluster deploy ./topology.yaml --user root -p
tiup cluster start tidb-test --init
tiup cluster start tidb-test
tiup cluster list
tiup cluster display tidb-test

Simple mode 1-1-1

tiup cluster template --local > topology.yaml 
tiup cluster deploy tidbtest v6.5.0 ./template.yaml --ssh=none

1.2.3 Common TiUP Commands

tiup cluster list
tiup cluster display tidb-test
tiup cluster start tidb-test
pd->tikv->tidb->tiflash
tiup cluster stop tidb-test
tiflash->tidb->tikv->pd

1.3 TiDB Files

pd: configuration, log, data files
tidb: configuration, log
tikv: configuration, log, data files