Course Notes: Deploying a Local Cluster with tiup playground

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

Original topic: 课程笔记 tiup playground 部署本地集群

| username: 云散月明

Course Link

TiDB Quick Start

Course Outline

  • History of Databases, Big Data, and TiDB

    • 01: History and Trends of Databases and Big Data

    • 02: Development of Distributed Relational Databases

    • 03: Evolution of TiDB Products and Open Source Community

  • Overview of TiDB

    • 04: What Kind of Database Do We Really Need

    • 05: How to Build a Distributed Storage System

    • 06: How to Build a Distributed SQL Engine

  • Selection of Next-Generation HTAP Databases

    • 07: HTAP Databases Based on Distributed Architecture

    • 08: Key Technological Innovations of TiDB

    • 09: Typical Application Scenarios and User Cases of TiDB

  • First Experience with TiDB

    • 10: First Experience with TiDB

Practice Notes


[ysym@localhost ~]$ 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 6968k  100 6968k    0     0  2696k      0  0:00:02  0:00:02 --:--:-- 2695k

WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json

You can revoke this by remove /home/ysym/.tiup/bin/7b8e153f2e2d0928.root.json

Successfully set mirror to https://tiup-mirrors.pingcap.com

Detected shell: bash

Shell profile:  /home/ysym/.bash_profile

/home/ysym/.bash_profile has been modified to add tiup to PATH

open a new terminal or source /home/ysym/.bash_profile to use it

Installed path: /home/ysym/.tiup/bin/tiup

===============================================

Have a try:     tiup playground

===============================================

[ysym@localhost ~]$ source /home/ysym/.bash_profile

[ysym@localhost ~]$ tiup playground v5.0.0 --db 2 --pd 3 --kv 3 --monitor

tiup is checking updates for component playground ...

A new version of playground is available:

   The latest version:         v1.10.2

   Local installed version:    

   Update current component:   tiup update playground

   Update all components:      tiup update --all

The component `playground` version  is not installed; downloading from repository.

download https://tiup-mirrors.pingcap.com/playground-v1.10.2-linux-amd64.tar.gz 7.31 MiB / 7.31 MiB 100.00% 3.88 MiB/s

Starting component `playground`: /home/ysym/.tiup/components/playground/v1.10.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:v5.0.0

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% 1.97 MiB/s        

Start pd instance:v5.0.0

Start pd instance:v5.0.0

Start tikv instance:v5.0.0

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% 3.82 MiB/s    

Start tikv instance:v5.0.0

Start tikv instance:v5.0.0

Start tidb instance:v5.0.0

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% 2.36 MiB/s      

Start tidb instance:v5.0.0

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% 3.84 MiB/s

download https://tiup-mirrors.pingcap.com/grafana-v5.0.0-linux-amd64.tar.gz 54.28 MiB / 54.28 MiB 100.00% 4.45 MiB/s  

Start tiflash instance:v5.0.0

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% 3.85 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

Connecting with tiup client


[ysym@localhost ~]$ tiup client

tiup is checking updates for component client ...

Starting component `client`: /home/ysym/.tiup/components/client/v1.10.2/tiup-client

Connected with driver mysql (5.7.25-TiDB-v5.0.0)

Type "help" for help.

my:root@127.0.0.1:4000=> \q

[ysym@localhost ~]$

Connecting with mysql client


[ysym@localhost ~]$ sudo -s

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for ysym:

[root@localhost ysym]# yum install mysql

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.huaweicloud.com

 * extras: mirrors.neusoft.edu.cn

 * updates: mirrors.163.com

Resolving Dependencies

--> Running transaction check

---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed

--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-5.5.68-1.el7.x86_64

--> Running transaction check

---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be updated

---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be an update

--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================

 Package                  Arch               Version                       Repository        Size

==================================================================================================

Installing:

 mariadb                  x86_64             1:5.5.68-1.el7                base             8.8 M

Updating for dependencies:

 mariadb-libs             x86_64             1:5.5.68-1.el7                base             760 k

Transaction Summary

==================================================================================================

Install  1 Package

Upgrade             ( 1 Dependent package)

Total size: 9.5 M

Total download size: 8.8 M

Is this ok [y/d/N]: y

Downloading packages:

warning: /var/cache/yum/x86_64/7/base/packages/mariadb-5.5.68-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Public key for mariadb-5.5.68-1.el7.x86_64.rpm is not installed

mariadb-5.5.68-1.el7.x86_64.rpm                                            | 8.8 MB  00:00:07    

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"

 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Updating   : 1:mariadb-libs-5.5.68-1.el7.x86_64                                             1/3

  Installing : 1:mariadb-5.5.68-1.el7.x86_64                                                  2/3

  Cleanup    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                           3/3

  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                             1/3

  Verifying  : 1:mariadb-5.5.68-1.el7.x86_64                                                  2/3

  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                                           3/3

Installed:

  mariadb.x86_64 1:5.5.68-1.el7                                                                  

Dependency Updated:

  mariadb-libs.x86_64 1:5.5.68-1.el7                                                              

Complete!

[root@localhost ysym]# mysql --host 127.0.0.1 --port 4000 -u root

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.7.25-TiDB-v5.0.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> \q

Bye

[root@localhost ysym]#

Monitoring Interface

Cleaning the Cluster


[ysym@localhost ~]$ tiup clean --all

Kill instance of `playground`, pid: 23232

Clean instance of `playground`, directory: /home/ysym/.tiup/data/T9HjVyF

[ysym@localhost ~]$