0
点赞
收藏
分享

微信扫一扫

TiUP playground 部署&启动集群

春意暖洋洋 2022-02-06 阅读 91
数据库

下载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
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
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 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:~$ 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
举报

相关推荐

0 条评论