## Module 5: Review TiDB Configuration Files

### Step 1. Review the topology configuration YAML

+ On the TiUP control machine, review the cluster topology and the locations of the configuration files. When you're done, type `:q!` to exit to the OS prompt on the Linux.

   ```bash
   tiup cluster edit-config tidb-demo
   ```

   ```output
   global:
     user: ec2-user
     ssh_port: 22
     ssh_type: builtin
     deploy_dir: /tidb-deploy
     data_dir: /tidb-data
     os: linux
     arch: amd64
     systemd_mode: system
   ...
   alertmanager_servers:
   - host: 10.90.4.138
     ssh_port: 22
     web_port: 9093
     cluster_port: 9094
     deploy_dir: /tidb-deploy/alertmanager-9093
     data_dir: /tidb-data/alertmanager-9093
     log_dir: /tidb-deploy/alertmanager-9093/log
     arch: amd64
     os: linux
   ```

### Step 2. Check TiDB server configuration directories on TiDB server 1

+ Connect to TiDB server 1 and list the configuration directories. Enter `yes` if prompted by `ssh`:

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_DB1_PRIVATE_IP} ls -l /tidb-deploy/tidb-4000/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user 25 May 25 04:16 bin
   drwxr-xr-x 2 ec2-user ec2-user 23 May 25 04:16 conf
   drwxr-xr-x 3 ec2-user ec2-user 90 May 25 04:21 log
   drwxr-xr-x 2 ec2-user ec2-user 25 May 25 04:16 scripts
   ```

### Step 3. Check TiKV server configuration directories on TiKV server 1

+ Connect to TiKV server 1 and view the contents of the `TiKV server` deployment directory. Enter `yes` if prompted by `ssh`:

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_KV1_PRIVATE_IP} ls -l /tidb-deploy/
   ```

   ```output
   total 0
   drwxr-xr-x 6 ec2-user ec2-user 55 May 25 04:16 monitor-9100
   drwxr-xr-x 6 ec2-user ec2-user 55 May 25 04:16 tikv-20160
   ```

+ Connect to TiKV server 1 and view the contents of the `TiKV server` configuration directory.

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_KV1_PRIVATE_IP} ls -l /tidb-deploy/tikv-20160/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user 25 May 25 04:16 bin
   drwxr-xr-x 2 ec2-user ec2-user 23 May 25 04:16 conf
   drwxr-xr-x 2 ec2-user ec2-user 45 May 25 04:20 log
   drwxr-xr-x 2 ec2-user ec2-user 25 May 25 04:16 scripts
   ```

+ Connect to TiKV server 1 and view the contents of the `TiKV server` data directory.

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_KV1_PRIVATE_IP} ls -l /tidb-data/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user   6 May 25 04:16 monitor-9100
   drwxr-xr-x 6 ec2-user ec2-user 164 May 25 04:20 tikv-20160
   ```

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_KV1_PRIVATE_IP} ls -l /tidb-data/tikv-20160/
   ```

   ```output
   total 1048672
   drwxr-xr-x 2 ec2-user ec2-user        134 May 25 04:20 db
   drwxr-xr-x 4 ec2-user ec2-user         33 May 25 04:20 import
   -rw-r--r-- 1 ec2-user ec2-user      20330 May 25 04:20 last_tikv.toml
   -rw-r--r-- 1 ec2-user ec2-user          0 May 25 04:20 LOCK
   -rw-r--r-- 1 ec2-user ec2-user          0 May 25 04:20 raftdb.info
   drwxr-xr-x 2 ec2-user ec2-user         82 May 25 04:20 raft-engine
   -rw-r--r-- 1 ec2-user ec2-user      75538 May 25 04:20 rocksdb.info
   drwxr-xr-x 2 ec2-user ec2-user          6 May 25 04:21 snap
   -rw-r--r-- 1 ec2-user ec2-user 1073741824 May 25 04:20 space_placeholder_file
   ```

### Step 4. Check Placement Driver server configuration directories on PD server 1

+ Connect to Placement Driver server 1, view the contents of the `PD server` configuration files directory. Enter `yes` if prompted by `ssh`.

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_PD1_PRIVATE_IP} ls -l /tidb-deploy/
   ```

   ```output
   total 0
   drwxr-xr-x 6 ec2-user ec2-user 55 May 25 04:16 monitor-9100
   drwxr-xr-x 6 ec2-user ec2-user 55 May 25 04:16 pd-2379
   ```

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_PD1_PRIVATE_IP} ls -l /tidb-deploy/pd-2379/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user 23 May 25 04:16 bin
   drwxr-xr-x 2 ec2-user ec2-user 21 May 25 04:16 conf
   drwxr-xr-x 2 ec2-user ec2-user 41 May 25 04:20 log
   drwxr-xr-x 2 ec2-user ec2-user 23 May 25 04:16 scripts
   ```

+ Connect to Placement Driver server 1, view the contents of the `PD server` data files directory.

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_PD1_PRIVATE_IP} ls -l /tidb-data/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user  6 May 25 04:16 monitor-9100
   drwxr-xr-x 5 ec2-user ec2-user 57 May 25 04:20 pd-2379
   ```

   ```bash
   ssh -i ~/.ssh/pe-class-key-${LAB:REGION_NAME}.pem ec2-user@${HOST_PD1_PRIVATE_IP} ls -l /tidb-data/pd-2379/
   ```

   ```output
   total 0
   drwxr-xr-x 2 ec2-user ec2-user 85 May 25 04:20 hot-region
   drwx------ 4 ec2-user ec2-user 29 May 25 04:20 member
   drwxr-xr-x 2 ec2-user ec2-user 85 May 25 04:20 region-meta
   ```

### Step 5. Stop the TiDB cluster

   ```bash
   tiup cluster stop tidb-demo --yes
   ```

   ```output
   + [ Serial ] - SSHKeySet: privateKey=/home/ec2-user/.tiup/storage/cluster/clusters/tidb-demo/ssh/id_rsa, publicKey=/home/ec2-user/.tiup/storage/cluster/clusters/tidb-demo/ssh/id_rsa.pub
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.95
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.90
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.158
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.1.169
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.1.56
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.4.126
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.4.138
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.4.138
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.4.138
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.138
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.242
   + [Parallel] - UserSSH: user=ec2-user, host=10.90.2.231
   + [ Serial ] - StopCluster
   ...
   Stopped cluster `tidb-demo` successfully
   ```

+ Exit the remote Linux

  ```bash
  exit
  ```
