下载TiUP工具
frank@DESKTOP-6NF3B9K:~$ curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6198k 100 6198k 0 0 4168k 0 0:00:01 0:00:01 --:--:-- 4168k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /home/frank/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile: /home/frank/.bashrc
/home/frank/.bashrc has been modified to add tiup to PATH
open a new terminal or source /home/frank/.bashrc to use it
Installed path: /home/frank/.tiup/bin/tiup
===============================================
Have a try: tiup playground
===============================================
设置环境变量
frank@DESKTOP-6NF3B9K:~$ source /home/frank/.bashrc
运行
运行最新的TiDB集群,其中TiDB、TiKV、PD和TiFlash实例各1个
frank@DESKTOP-6NF3B9K:~$ tiup playground
Starting component `playground`: /home/frank/.tiup/components/playground/v1.8.2/tiup-playground
Using the version v5.3.0 for version constraint "".
If you'd like to use a TiDB version other than v5.3.0, cancel and retry with the following arguments:
Specify version manually: tiup playground <version>
Specify version range: tiup playground ^5
The nightly version: tiup playground nightly
Playground Bootstrapping...
Start pd instance
Start tikv instance
Start tidb instance
127.0.0.1:4000 ... Done
Start tiflash instance
127.0.0.1:3930 ... Done
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4000 -u root -p (no password)
To view the dashboard: http://127.0.0.1:2379/dashboard
PD client endpoints: [127.0.0.1:2379]
To view the Prometheus: http://127.0.0.1:9090
To view the Grafana: http://127.0.0.1:3000
指定版本,指定各实例启动数量
frank@DESKTOP-6NF3B9K:~$ tiup playground v5.0.0 --db 2 --pd 3 --kv 3 --monitor
Starting component `playground`: /home/frank/.tiup/components/playground/v1.8.2/tiup-playground v5.0.0 --db 2 --pd 3 --kv 3 --monitor
Flag --monitor has been deprecated, Please use --without-monitor to control whether to disable monitor.
Playground Bootstrapping...
Start pd instance
The component `pd` version v5.0.0 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/pd-v5.0.0-linux-amd64.tar.gz 41.09 MiB / 41.09 MiB 100.00% 9.57 MiB/s
Start pd instance
Start pd instance
Start tikv instance
The component `tikv` version v5.0.0 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tikv-v5.0.0-linux-amd64.tar.gz 161.21 MiB / 161.21 MiB 100.00% 9.64 MiB/s
Start tikv instance
Start tikv instance
Start tidb instance
The component `tidb` version v5.0.0 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tidb-v5.0.0-linux-amd64.tar.gz 45.73 MiB / 45.73 MiB 100.00% 4.56 MiB/s
Start tidb instance
Waiting for tidb instances ready
127.0.0.1:4000 ... Done
127.0.0.1:4001 ... Done
The component `prometheus` version v5.0.0 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/prometheus-v5.0.0-linux-amd64.tar.gz 39.84 MiB / 39.84 MiB 100.00% 10.14 MiB/s
download https://tiup-mirrors.pingcap.com/grafana-v5.0.0-linux-amd64.tar.gz 54.28 MiB / 54.28 MiB 100.00% 8.11 MiB/s
Start tiflash instance
The component `tiflash` version v5.0.0 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tiflash-v5.0.0-linux-amd64.tar.gz 407.93 MiB / 407.93 MiB 100.00% 8.14 MiB/s
Waiting for tiflash instances ready
127.0.0.1:3930 ... Done
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4000 -u root -p (no password)
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4001 -u root -p (no password)
To view the dashboard: http://127.0.0.1:2379/dashboard
PD client endpoints: [127.0.0.1:2379 127.0.0.1:2382 127.0.0.1:2384]
To view the Prometheus: http://127.0.0.1:9090
To view the Grafana: http://127.0.0.1:3000
查看面板
客户端链接集群
frank@DESKTOP-6NF3B9K:~$ mycli -h127.0.0.1 -P4000 -uroot
MySQL 5.7.25
mycli 1.24.3
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Thanks to the contributor - mrdeathless
MySQL root@127.0.0.1:(none)> show databases;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql |
| test |
+--------------------+
5 rows in set
Time: 0.006s
MySQL root@127.0.0.1:(none)>
停止集群
ctrl-c
^CPlayground receive signal: interrupt
Got signal interrupt (Component: playground ; PID: 10334)
Wait tiflash(10923) to quit...
tiflash quit
Wait tidb(10803) to quit...
tidb quit
Wait tidb(10797) to quit...
tidb quit
Wait tikv(10453) to quit...
tikv quit
Wait tikv(10442) to quit...
tikv quit
Wait tikv(10440) to quit...
tikv quit
Wait pd(10371) to quit...
pd quit
Wait pd(10363) to quit...
pd quit
Wait pd(10355) to quit...
pd quit
prometheus quit
Grafana quit
清理集群
frank@DESKTOP-6NF3B9K:~$ tiup clean --all
|