The author | | JiekeXu source JiekeXu DBA road (ID: JiekeXu_IT)
Hello, everyone, I am JiekeXu, glad to meet you again, today we come to experience TiDB 5.0, welcome to click on the blue word to follow me, mark the star or place the top, more dry goods will arrive at the first time!
TiDB is an open source distributed relational database independently designed and developed by PingCAP. It is a simultaneously supported databaseHybrid Transactional and Analytical Processing (HTAP) is a Hybrid Transactional and Analytical Processing (HTAP) distributed database, with horizontal expansion or reduction, financial high availability, real-time HTAP, cloud native distributed database,Compatibility with important features such as MySQL 5.7 protocol and MySQL ecology. It is also the no.1 domestic database in Motianlun list. You can click here to view the domestic database list this month. The TiDBThe goal is to provide users with one-stop Online Transactional Processing (OLTP), Online Analytical Processing (OLAP), and HTAP solutions. TiDB is suitable for various application scenarios such as high availability, high consistency requirements, and large data scale. TiDB 5.0 was released in April, followed by TiDB 5.1 on June 24. The core architecture diagram is as follows:
In general, it consists of a three-part cluster of TiDB, TiKV, and PD, plus monitoring services such as Grafana and Dashboard. Looking at the topology of the smallest deployment below, it is absolutely impossible for individuals to install such an environment on their laptops.
Therefore, it can be seen that ten machines are required, and the minimum memory is 8GB, so personal notebooks certainly cannot meet the requirements. However, TiDB 5.0 provides a command for playground. You can use a Linux machine to simulate and build a cluster environment on personal notebooks, as long as your machine is connected to the Internet, you can build it. The steps are very simple, let’s experience it together.
First of all, you need a Linux machine and an Internet connection. See my previous article on installing openGauss for details.
Network adapter select [NAT] mode, view the network configuration of the host wireless adapter about NET8, and then select [Edit] — > [Virtual Network Editor] — > [DHCP Settings] in the VM, the subnet IP needs to be in the same network segment as previously seen, and then select DHCP automatic obtain.
The NIC configuration is as follows:
[root@JiekeXu-Test network-scripts]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
[root@JiekeXu-Test network-scripts]# free -m
total used free shared buff/cache available
Mem: 7802 5682 142 42 1977 1832
Swap: 6143 0 6143
[root@JiekeXu-Test network-scripts]# more ifcfg-ens32
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens32"
UUID="e8332396-7724-410f-9887-1fc0e27fc818"
DEVICE="ens32"
ONBOOT="yes"
GATEWAY="192.168.75.2"
IPADDR="192.168.75.128"
PREFIX="24"
IPV6_PRIVACY="no"
Copy the code
Download and install TiUP
Run the following curl command
Curl, proto '= HTTPS' - tlsv1.2 - sSf https://tiup-mirrors.pingcap.com/install.sh | shCopy the code
The environment variable source root/. Bash_profile is export PATH=/root/.tiup/bin:$PATH a command.
A cluster environment was simulated using Tiup Playground
Executing tiup playground directly will run the latest version of the TiDB cluster with one instance of TiDB, TiKV, PD, and TiFlash:
tiup playground
Copy the code
Of course, you can also specify the number of components and instances
[root@JiekeXu-Test ~]# Tiup playground v5.0.0 -- DB 2 -- PD 3 -- KV 3 --monitorCopy the code
The above commands will download and start a version of the cluster locally (for example, V5.1.0), –monitor means that monitoring components are deployed at the same time. The latest version can be viewed by executing tiup list tidb.
Available versions for tidb: Version Installed Release Platforms -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the nightly - > v5.0.0 - the nightly - 20210718 The 2021-07-18 T21: oh + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.0 T14:2020-04-16 03:31 + 08:00 Darwin/amd64, Linux/amd64 V3.0 2020-04-16T16:58:06+08:00 Darwin/AMD64, Linux/AMD64 V3.0.1 2020-04-27T19:38:36+08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.2 T23:2020-04-16 is + 08:00 Darwin/amd64, Linux/amd64 v3.0.3 2020-04-17T00:16:31+08:00 Darwin/AMd64, Linux/AMd64 V3.0.4 2020-04-17T00:22:46+08:00 Darwin/AMd64, Linux/AMd64 v3.0.5 2020-04-17T00:29:45+08:00 Darwin/AMd64, Linux/AMd64 V3.0.6 2020-04-17T00:39:33+08:00 Darwin/AMd64, Linux/AMd64 v3.0.7 2020-04-17T00:46:32+08:00 Darwin/AMd64, Linux/AMd64 V3.0.8 2020-04-17T00:54:19+08:00 Darwin/AMd64, Linux/AMd64 v3.0.9 2020-04-17T01:00:58+08:00 Darwin/AMd64, Linux/AMd64 V3.0.10 2020-03-13T14:11:53.774527401+08:00 Darwin/AMd64, Linux /amd64 V3.0.11 2020-04-17T01:09:20+08:00 Darwin/AMd64, Linux/AMd64 V3.0.12 2020-04-17T01:16:04+08:00 Darwin/AMd64, Linux /amd64 V3.0.13 2020-04-26T17:25:01+08:00 Darwin/AMD64, Linux/AMD64 V3.0.14 2020-05-09T21:11:49+08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.15 T16 2020-06-05:53:32 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.16 The 2020-07-03 T20:07:45 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.17 T15:2020-08-03 people + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.18 T20:2020-08-21 02:59 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.19 The 2020-09-25 T18:24:11 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.0.20 T15:2020-12-25 joined + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.0 - beta 2020-05-22 T14:35:59 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 22:30 v3.1.0 - beta. 1 the T15:2020-05-22 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.0 - beta. 2 the T15:2020-05-22 things + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.0 - rc 2020-05-22 T15:56:23 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.0 The 2020-05-22 T15: shall + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.1 T21:2020-04-30 02:32 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v3.1.2 T17:2020-06-04 55:40 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 - beta : the 2020-05-26 T11 18:05 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 - beta. 1: the 2020-05-26 T11 42:48 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 - beta. 2: the 2020-05-26 T11 56:51 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 V4.0.0 - rc 2020-05-26 T14:56:06 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 - rc. 1 2020-04-29 T01:03:31 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 - rc. 2 2020-05-15 T21:54:51 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.0 The 2020-05-28 T20: even the + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.1 T21:2020-06-12 11 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.2 T19:2020-07-01 59:39 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.3 The 2020-07-25 T01:03:31 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.4 T16 2020-07-31:44:42 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.5 T23:2020-08-31 53:35 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.6 The T22:2020-09-15 + 08:00 supposing, Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.7 T20:2020-09-29 15:07 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.8 T19:2020-10-30 son + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.9 The 2020-12-21 T17: because + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.10 T13:2021-01-15 15:09 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.11 T17:2021-02-26 acted treacherously + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 V4.0.12-20210427 2021-05-08T11:09:37+08:00 Linux/AMD64 V4.0.12 2021-04-02T16:55:00+08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v4.0.13 T22 2021-05-27: oh + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 The 2021-03-29 T19 v5.0.0-20210329: the earth + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.0-20210403 2021-04-03 T09: then + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.0 T17-20210408 2021-04-08:02:41 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 V5.0.0 - the nightly - 20210718 2021-07-18 T21: oh + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.0 - rc The 2021-01-12 T23: speakest + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.0 T17: YES 2021-04-07 30:00 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 version 5.0.1 T21:2021-04-24 beeves + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.2 The 2021-06-09 T22: a + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.0.3 T16 2021-07-02: and + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64 v5.1.0 T16 2021-06-24:23:50 + 08:00 Darwin/amd64, Linux/amd64, Linux/arm64Copy the code
-
Playground executed this way, TiUP will clean up the original cluster data after the deployment test, and re-execute this command to get a new cluster.
-
If you want to persist the data, you can execute the –tag parameter of TiUP, for example: TiUP –tag ‘/root’ playground v5.1.0 –db 3 –pd 3 –kv 3 –monitor
-
-t, –tag (string) : Specifies a tag for the started component: If a component needs disk storage during execution, TiUP allocates a temporary directory as the storage directory for the execution of the component. If you want to assign a fixed directory, you can specify the directory name with -t /–tag, so that multiple executions can read and write to the same set of files using the same tag.
You can connect to TiDB 5.0 using MySQL client or TiUP Client
[root@JiekeXu-Test ~]# tiup client select client connection
[root@JiekeXu-Test ~]# tiup client Starting component `client`: / root/tiup/components/client/v1.5.2 / tiup - client Connected with driver mysql (5.7.25 - TiDB - v5.0.0) Type "help" for help. My: [email protected]:4000 = > select tidb_version () \ G * * * * * * * * * * * * * * * * * * * * * * * * * * * 1 row * * * * * * * * * * * * * * * * * * * * * * * * * * * Tidb_version (): Release Version: v5.0.0 Edition: Community Git Commit Hash: Bdac0885cd11bdf571aad9353bfc24e13554b91c Git Branch: heads/refs/tags/v5.0.0 UTC Build Time: 2021-04-06 16:36:29 GoVersion: GO1.13 Race Enabled: false TiKV Min Version: V3.0.0-60965 b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false my: [email protected]:4000 = > show databases; Database -------------------- INFORMATION_SCHEMA METRICS_SCHEMA PERFORMANCE_SCHEMA mysql test (5 rows) My: [email protected]:4000 = > use the test; USE my: [email protected]:4000 = > show tables; (0 rows) my:[email protected]:4000=> my:[email protected]:4000=> use mysql; USE my: [email protected]:4000 = > show tables; Tables_in_mysql ------------------------- GLOBAL_VARIABLES bind_info columns_priv db default_roles expr_pushdown_blacklist gc_delete_range gc_delete_range_done global_priv help_topic opt_rule_blacklist role_edges schema_index_usage stats_buckets stats_extended stats_feedback stats_fm_sketch stats_histograms stats_meta stats_top_n tables_priv tidb user (23 rows)Copy the code
My: [email protected]:4001 = > show databases; Database -------------------- INFORMATION_SCHEMA METRICS_SCHEMA PERFORMANCE_SCHEMA mysql test (5 rows) My: [email protected]:4001 = > use METRICS_SCHEMA; USE my: [email protected]:4001 = >Copy the code
MySQL client connection
[root@JiekeXu-Test ~]# mysql --host 127.0.0.1 --port 4001 -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 9 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)]> show databases; +--------------------+ | Database | +--------------------+ | INFORMATION_SCHEMA | | METRICS_SCHEMA | | PERFORMANCE_SCHEMA | | mysql | | test | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + 5 rows in the set (0.00 SEC) mysql/(none) > select version(); + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | version () | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | 5.7.25 TiDB - v5.0.0 | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + 1 row in the set (0.01sec) MySQL [(none)]> use MySQL; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MySQL [mysql]> MySQL [mysql]> show processlist; +------+------+-----------------+-------+---------+------+------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | + -- -- -- -- -- - + -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- + + -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | | 9 root | 127.0.0.1:43032 | mysql | Query | | 0 the autocommit | show the processlist | | | 11 root | 127.0.0.1:43182 | mysql | Sleep | 127 | the autocommit | NULL | + -- -- -- -- -- - + -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- + + -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + 2 rows in the set (0.00) sec) MySQL [mysql]>Copy the code
In addition to the connection, you can also log in to the monitoring system, open Firefox on the VM GUI, and clickhttp://127.0.0.1:9090Access the Prometheus management interface of TiDB. throughhttp://127.0.0.1:2379/dashboardThe default user name and password for accessing the TiDB Dashboard page are root and empty.
Of course, this is just a quick experience. When Tiup playground v5.0.0 — DB 2 –pd 3 — KV 3 –monitor execution result window CTRL + C is cancelled, the cluster will no longer exist. The tiup playground command will be used again next time. Tag doesn’t feel good and the experience is not very good. Hope to continue to improve.
[root@JiekeXu-Test ~]# tiup playground v5.0.0 --db 2 --pd 3 --kv 3 --monitor Starting component 'playground' : / root/tiup/components/playground/v1.5.2 / tiup - playground v5.0.0 - db 2-3 - kv pd 3 - monitor Using the version v5.0.0 For version constraint "v5.0.0". If you'd like to use a TiDB version other than V5.0.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 pd instance Start pd instance Start tikv instance Start tikv instance Start tikv instance Start Tidb Instance Start Tidb instance Waiting for Tidb Instances Ready 127.0.0.1:4000... The Done 127.0.0.1:4001... Done Start Tiflash Instance Waiting for Tiflash Instances Ready 127.0.0.1:3930... Done CLUSTER START SUCCESSFULLY, Enjoy it ^-^ To connect TiDB: --host 127.0.0.1 --port 4000 -u root -p (no password) --comments To connect TiDB: Mysql --host 127.0.0.1 --port 4001 -u root -p (no password) -- Comments 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:3000Copy the code
How to use backup and restore tool BR to backup and restore data and how to use data export tool Dumpling. Here are some quick experiences for you. Here is my address, welcome more friends to tease. If this article is helpful to you, welcome to like, look at and forward, writing is not easy, insist on writing is not easy, your like, forward effortlessly, is the biggest support for the author, but also let more people benefit, thank you!
— — — — — — — — — — — — — –
The public number: JiekeXu DBA The ink head sheave: www.modb.pro/u/4347 CSDN: blog.csdn.net/JiekeXu tencent cloud: cloud.tencent.com/developer/u…
— — — — — — — — — — — — — –
July 2021 Domestic database ranking :openGauss soaring, GBase continues to fall
Oracle 19C MAA Setup Guide
A hundred flowers blooming domestic database