## Module 3: Check The Status Of The Deployed TiDB Cluster

### Step 1. Check TiDB cluster status by using TiUP

+ On the TiUP Control Machine, check the clusters managed by TiUP.

   ```bash
   tiup cluster list
   ```

   ```output
   Name       User      Version  Path                                                     PrivateKey
   ----       ----      -------  ----                                                     ----------
   tidb-demo  ec2-user  v${LAB:TIDB_VERSION}   /home/ec2-user/.tiup/storage/cluster/clusters/tidb-demo  /home/ec2-user/.tiup/storage/cluster/clusters/tidb-demo/ssh/id_rsa
   ```

+ Check the status of the deployed TiDB cluster, all components are not running yet.

   ```bash
   tiup cluster display tidb-demo
   ```

   ```output
   Cluster type:       tidb
   Cluster name:       tidb-demo
   Cluster version:    v${LAB:TIDB_VERSION}
   Deploy user:        ec2-user
   SSH type:           builtin
   Grafana URL:        http://10.90.4.138:3000
   ID                 Role          Host         Ports                            OS/Arch       Status  Data Dir                      Deploy Dir
   --                 ----          ----         -----                            -------       ------  --------                      ----------
   10.90.4.138:9093   alertmanager  10.90.4.138  9093/9094                        linux/x86_64  Down    /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
   10.90.4.138:3000   grafana       10.90.4.138  3000                             linux/x86_64  Down    -                             /tidb-deploy/grafana-3000
   10.90.2.138:2379   pd            10.90.2.138  2379/2380                        linux/x86_64  Down    /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.2.231:2379   pd            10.90.2.231  2379/2380                        linux/x86_64  Down    /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.2.90:2379    pd            10.90.2.90   2379/2380                        linux/x86_64  Down    /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.4.138:9090   prometheus    10.90.4.138  9090/12020                       linux/x86_64  Down    /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
   10.90.1.169:4000   tidb          10.90.1.169  4000/10080                       linux/x86_64  Down    -                             /tidb-deploy/tidb-4000
   10.90.1.56:4000    tidb          10.90.1.56   4000/10080                       linux/x86_64  Down    -                             /tidb-deploy/tidb-4000
   10.90.4.126:9000   tiflash       10.90.4.126  9000/8123/3930/20170/20292/8234  linux/x86_64  N/A     /tidb-data/tiflash-9000       /tidb-deploy/tiflash-9000
   10.90.2.158:20160  tikv          10.90.2.158  20160/20180                      linux/x86_64  N/A     /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   10.90.2.242:20160  tikv          10.90.2.242  20160/20180                      linux/x86_64  N/A     /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   10.90.2.95:20160   tikv          10.90.2.95   20160/20180                      linux/x86_64  N/A     /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   Total nodes: 12
   ```

### Step 2. Start the TiDB cluster

+ Start the TiDB cluster with standard startup mode (database root user with empty password). In this step, we do NOT use the `--init` option to generate a random password for the database root user.

   ```bash
   tiup cluster start tidb-demo
   ```

   ```output
   ...
   Started cluster `tidb-demo` successfully
   ```

+ Check the status of the started TiDB cluster. The URLs for TiDB Dashboard and Grafana are also displayed. Proceed to the next step.

   ```bash
   tiup cluster display tidb-demo
   ```

   ```output
   Cluster type:       tidb
   Cluster name:       tidb-demo
   Cluster version:    v${LAB:TIDB_VERSION}
   Deploy user:        ec2-user
   SSH type:           builtin
   Dashboard URL:      http://34.222.39.121:2379/dashboard
   Grafana URL:        http://10.90.4.138:3000
   ID                 Role          Host         Ports                            OS/Arch       Status  Data Dir                      Deploy Dir
   --                 ----          ----         -----                            -------       ------  --------                      ----------
   10.90.4.138:9093   alertmanager  10.90.4.138  9093/9094                        linux/x86_64  Up      /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
   10.90.4.138:3000   grafana       10.90.4.138  3000                             linux/x86_64  Up      -                             /tidb-deploy/grafana-3000
   10.90.2.138:2379   pd            10.90.2.138  2379/2380                        linux/x86_64  Up|L    /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.2.231:2379   pd            10.90.2.231  2379/2380                        linux/x86_64  Up      /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.2.90:2379    pd            10.90.2.90   2379/2380                        linux/x86_64  Up      /tidb-data/pd-2379            /tidb-deploy/pd-2379
   10.90.4.138:9090   prometheus    10.90.4.138  9090/12020                       linux/x86_64  Up      /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
   10.90.1.169:4000   tidb          10.90.1.169  4000/10080                       linux/x86_64  Up      -                             /tidb-deploy/tidb-4000
   10.90.1.56:4000    tidb          10.90.1.56   4000/10080                       linux/x86_64  Up      -                             /tidb-deploy/tidb-4000
   10.90.4.126:9000   tiflash       10.90.4.126  9000/8123/3930/20170/20292/8234  linux/x86_64  Up      /tidb-data/tiflash-9000       /tidb-deploy/tiflash-9000
   10.90.2.158:20160  tikv          10.90.2.158  20160/20180                      linux/x86_64  Up      /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   10.90.2.242:20160  tikv          10.90.2.242  20160/20180                      linux/x86_64  Up      /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   10.90.2.95:20160   tikv          10.90.2.95   20160/20180                      linux/x86_64  Up      /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
   Total nodes: 12
   ```

### Step 3. Check cluster status with TiDB Dashboard and Grafana Dashboard

+ Use your browser to log into the [TiDB PD Dashboard](http://${LAB:HOST_PD1_PUBLIC_IP}:2379/dashboard), the username and password is the same as that of the TiDB `root` user. The password is empty if you followed the lab guide by choosing the standard startup. The home page displays the node information for the TiDB cluster.

+ You can also check the cluster status with the [Grafana Prometheus Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000). The default username and password for Grafana are both `admin`.

  ![40](https://lab-static.pingcap.com/quick-demo/Grafana_aa_001_20220615.png)
