From 7631d50216de04b5752c9cb92dcdfeb2f5986739 Mon Sep 17 00:00:00 2001 From: Ran Date: Wed, 3 Jun 2020 19:16:28 +0800 Subject: [PATCH 1/4] deploy: add doc for post installation check --- post-installation-check.md | 200 +++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 post-installation-check.md diff --git a/post-installation-check.md b/post-installation-check.md new file mode 100644 index 0000000000000..ca66b3192ec5f --- /dev/null +++ b/post-installation-check.md @@ -0,0 +1,200 @@ +--- +title: Check Cluster Running Status +summary: Learn how to check the running status of the TiDB cluster. +category: how-to +--- + +# Check Cluster Running Status + +This document describes how to check the cluster status via TiDB Dashboard and Grafana, and how to log in to the database to perform simple DML and DDL operations and SQL statements. + +## Check the TiDB cluster status + +This section describes how to check the TiDB cluster status using TiDB Dashboard and Grafana. + +### Use TiDB Dashboard + +1. Log in to TiDB Dashboard at `${pd-ip}:${pd-port}/dashboard`. The username and password is the same as that of the TiDB `root` user. If you have modified the `root` password, enter the modified password. The password is empty by default. + + ![TiDB-Dashboard](/media/tiup/tidb-dashboard.png) + +2. The home page displays the node information in the TiDB cluster. + + ![TiDB-Dashboard-status](/media/tiup/tidb-dashboard-status.png) + +### Use Grafana + +1. Log in to the Grafana monitoring at `${Grafana-ip}:3000`. The default username and password are both `admin`. + + ![Grafana-login](/media/tiup/grafana-login.png) + +2. To check the TiDB port status and load monitoring information, click **Overview**. + + ![Grafana-overview](/media/tiup/grafana-overview.png) + +## Log in to the database and perform simple operations + +> **Note:** +> +> Install the MySQL client before you log in to the database. + +Log in to the database by running the following command: + +{{< copyable "shell-regular" >}} + +```shell +mysql -u root -h 10.0.1.4 -P 4000 +``` + +The following information indicates successful login: + +```sql +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MySQL connection id is 1 +Server version: 5.7.25-TiDB-v4.0.0-beta-446-g5268094af TiDB Server (Apache License 2.0), 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. +``` + +### Database operations + +- Check the version of TiDB: + + {{< copyable "sql" >}} + + ```sql + select tidb_version()\G + ``` + + Expected output: + + ```sql + *************************** 1. row *************************** + tidb_version(): Release Version: v4.0.0-beta-446-g5268094af + Git Commit Hash: 5268094afe05c7efef0d91d2deeec428cc85abe6 + Git Branch: master + UTC Build Time: 2020-03-17 02:22:07 + GoVersion: go1.13 + Race Enabled: false + TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 + Check Table Before Drop: false + 1 row in set (0.00 sec) + MySQL [tidb]> create database pingcap; + Query OK, 0 rows affected (0.10 sec) + ``` + +- Create a database named `pingcap`: + + {{< copyable "sql" >}} + + ```sql + create database pingcap; + ``` + + Expected output: + + ```sql + Query OK, 0 rows affected (0.10 sec) + ``` + + Switch to the `pingcap` database: + + {{< copyable "sql" >}} + + ```sql + use pingcap; + ``` + + Expected output: + + ```sql + Database changed + ``` + +- Create a table named `tab_tidb`: + + {{< copyable "sql" >}} + + ```sql + CREATE TABLE `tab_tidb` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL DEFAULT '', + `age` int(11) NOT NULL DEFAULT 0, + `version` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `idx_age` (`age`)); + ``` + + Expected output: + + ```sql + Query OK, 0 rows affected (0.11 sec) + ``` + +- Insert data: + + {{< copyable "sql" >}} + + ```sql + insert into `tab_tidb` values (1,'TiDB',5,'TiDB-v4.0.0'); + ``` + + Expected output: + + ```sql + Query OK, 1 row affected (0.03 sec) + ``` + +- View the entries in `tab_tidb`: + + {{< copyable "sql" >}} + + ```sql + select * from tab_tidb; + ``` + + Expected output: + + ```sql + +----+------+-----+-------------+ + | id | name | age | version | + +----+------+-----+-------------+ + | 1 | TiDB | 5 | TiDB-v4.0.0 | + +----+------+-----+-------------+ + 1 row in set (0.00 sec) + ``` + +- View the store state, `store_id`, capacity, and uptime of TiKV: + + {{< copyable "sql" >}} + + ```sql + select STORE_ID,ADDRESS,STORE_STATE,STORE_STATE_NAME,CAPACITY,AVAILABLE,UPTIME from INFORMATION_SCHEMA.TIKV_STORE_STATUS; + ``` + + Expected output: + + ```sql + +----------+--------------------+-------------+------------------+----------+-----------+--------------------+ + | STORE_ID | ADDRESS | STORE_STATE | STORE_STATE_NAME | CAPACITY | AVAILABLE | UPTIME | + +----------+--------------------+-------------+------------------+----------+-----------+--------------------+ + | 1 | 10.0.1.1:20160 | 0 | Up | 49.98GiB | 46.3GiB | 5h21m52.474864026s | + | 4 | 10.0.1.2:20160 | 0 | Up | 49.98GiB | 46.32GiB | 5h21m52.522669177s | + | 5 | 10.0.1.3:20160 | 0 | Up | 49.98GiB | 45.44GiB | 5h21m52.713660541s | + +----------+--------------------+-------------+------------------+----------+-----------+--------------------+ + 3 rows in set (0.00 sec) + ``` + +- Exit TiDB: + + {{< copyable "sql" >}} + + ```sql + exit + ``` + + Expected output: + + ```sql + Bye + ``` From 47410aa57d6a7599ad10347739c6a3351131fd8e Mon Sep 17 00:00:00 2001 From: Ran Date: Wed, 3 Jun 2020 19:20:30 +0800 Subject: [PATCH 2/4] update the output --- post-installation-check.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/post-installation-check.md b/post-installation-check.md index ca66b3192ec5f..e54cc2676ebc6 100644 --- a/post-installation-check.md +++ b/post-installation-check.md @@ -49,10 +49,14 @@ mysql -u root -h 10.0.1.4 -P 4000 The following information indicates successful login: ```sql -Welcome to the MariaDB monitor. Commands end with ; or \g. -Your MySQL connection id is 1 -Server version: 5.7.25-TiDB-v4.0.0-beta-446-g5268094af TiDB Server (Apache License 2.0), MySQL 5.7 compatible -Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 3 +Server version: 5.7.25-TiDB-v4.0.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible +Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. ``` @@ -70,17 +74,16 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. ```sql *************************** 1. row *************************** - tidb_version(): Release Version: v4.0.0-beta-446-g5268094af - Git Commit Hash: 5268094afe05c7efef0d91d2deeec428cc85abe6 - Git Branch: master - UTC Build Time: 2020-03-17 02:22:07 - GoVersion: go1.13 + tidb_version(): Release Version: v4.0.0 + Edition: Community + Git Commit Hash: 689a6b6439ae7835947fcaccf329a3fc303986cb + Git Branch: HEAD + UTC Build Time: 2020-05-28 11:09:45 + GoVersion: go1.13.4 Race Enabled: false TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false 1 row in set (0.00 sec) - MySQL [tidb]> create database pingcap; - Query OK, 0 rows affected (0.10 sec) ``` - Create a database named `pingcap`: From b890f43afd66452e53ba1e63612e6ae1e0b781c8 Mon Sep 17 00:00:00 2001 From: yikeke Date: Fri, 5 Jun 2020 20:59:49 +0800 Subject: [PATCH 3/4] Update TOC.md --- TOC.md | 1 + 1 file changed, 1 insertion(+) diff --git a/TOC.md b/TOC.md index bfe148c478f1e..1ed19db57f083 100644 --- a/TOC.md +++ b/TOC.md @@ -59,6 +59,7 @@ - [Use TiDB Ansible](/online-deployment-using-ansible.md) - [Use TiDB Ansible Offline](/offline-deployment-using-ansible.md) - [Use Docker](/test-deployment-using-docker.md) + + [Check Cluster Status](/post-installation-check.md) + Geographic Redundancy - [Overview](/geo-redundancy-deployment.md) - [Configure Location Awareness](/location-awareness.md) From 0d34b49d34d87925658cec7080e29e19ba8289fb Mon Sep 17 00:00:00 2001 From: yikeke Date: Fri, 5 Jun 2020 21:14:18 +0800 Subject: [PATCH 4/4] Update post-installation-check.md --- post-installation-check.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/post-installation-check.md b/post-installation-check.md index e54cc2676ebc6..631d085c33ed2 100644 --- a/post-installation-check.md +++ b/post-installation-check.md @@ -1,12 +1,12 @@ --- -title: Check Cluster Running Status +title: Check Cluster Status summary: Learn how to check the running status of the TiDB cluster. category: how-to --- -# Check Cluster Running Status +# Check Cluster Status -This document describes how to check the cluster status via TiDB Dashboard and Grafana, and how to log in to the database to perform simple DML and DDL operations and SQL statements. +This document describes how to check the cluster status via TiDB Dashboard and Grafana, and how to log in to the TiDB database to perform simple DML and DDL operations and SQL queries. ## Check the TiDB cluster status