TiDB入门篇-TiDB初体验playground

简介

TiDB 是一个分布式系统。最基础的 TiDB 测试集群通常由 2 个 TiDB 实例、3 个 TiKV 实例、3 个 PD 实例和可选的 TiFlash 实例构成。通过 TiUP Playground,可以快速搭建出上述的一套基础测试集群。

TiDB 数据库快速上手指南 | PingCAP 文档中心

操作

安装TiUP

curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
[root@master ~]# 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 7088k  100 7088k    0     0  2966k      0  0:00:02  0:00:02 --:--:-- 2966k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /root/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile:  /root/.bash_profile
/root/.bash_profile has been modified to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================

更具上面的提示执行下面的命令。 

source /root/.bash_profile

运行模拟集群

下面指定的--host是外网的ip如果不指定那么就是127.0.0.1外部电脑就访问不了。

tiup playground v6.5.1 --db 2 --pd 3 --kv 3 --host 192.168.66.10

执行以后打印如下 

[root@master ~]# tiup playground v6.5.1 --db 2 --pd 3 --kv 3 --host 192.168.66.10
tiup is checking updates for component playground ...
Starting component `playground`: /root/.tiup/components/playground/v1.11.3/tiup-playground v6.5.1 --db 2 --pd 3 --kv 3 --host 192.168.66.10
Playground Bootstrapping...
Start pd instance:v6.5.1
Start pd instance:v6.5.1
Start pd instance:v6.5.1
Start tikv instance:v6.5.1
Start tikv instance:v6.5.1
Start tikv instance:v6.5.1
Start tidb instance:v6.5.1
Start tidb instance:v6.5.1
Waiting for tidb instances ready
192.168.66.10:4000 ... Done
192.168.66.10:4001 ... Done
Start tiflash instance:v6.5.1
Waiting for tiflash instances ready
192.168.66.10:3930 ... Done
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --comments --host 192.168.66.10 --port 4000 -u root -p (no password)
To connect TiDB: mysql --comments --host 192.168.66.10 --port 4001 -u root -p (no password)
To view the dashboard: http://192.168.66.10:2379/dashboard
PD client endpoints: [192.168.66.10:2379 192.168.66.10:2382 192.168.66.10:2384]
To view the Prometheus: http://192.168.66.10:9090
To view the Grafana: http://192.168.66.10:3000

执行以后应该上面的是一个模拟环境,所以如果关闭窗口了那么集群就会停止。

所以我们新开一个窗口登录(初始没有密码直接回车就行)

mysql --comments --host 127.0.0.1 --port 4001 -u root -p

登录可视化界面 ,默认密码为空,指定登录。

http://192.168.66.10:2379/dashboard/#/signin

 

 登录监控页面

http://192.168.66.10:3000/login 

 

账号密码都是admin 

 

猜你喜欢

转载自blog.csdn.net/S1124654/article/details/129766129
今日推荐