# Step 4: Executing Deployment Command

__*TiDB deployment steps*__
__*TiUP deployment command*__
__*zz-BGL*__
__*zz-Jeff*__


+ Check for potential risks:
  + **`tiup cluster check ./topology.yaml --user root [-p] [-i /home/root/.ssh/rsa_key]`**

+ Enable automatic repair:
  + **`tiup cluster check ./topology.yaml --apply --user root [-p] [-i /home/root/.ssh/rsa_key]`**

+ Execute the **`deploy`** command to deploy the TiDB cluster named `tidb-test`:
  + **`tiup cluster deploy tidb-test v6.5.0 ./topology.yaml --user root [-p] [-i /home/root/.ssh/rsa_key]`**

+ **`--user root`** logs into target machines to complete the cluster deployment. 
  + The user used here must have **`ssh`** and **`sudo`** privileges to the target machine

-------------------------------------------------------------
You can use secret keys or interactive passwords for security authentication when you deploy `TiDB` using `TiUP`:
- If you use secret keys, specify the path of the keys through `-i` or `--identity_file`.
- If you use passwords, add the `-p` flag to enter the password interaction window.
- If `password-free` login to the target machine has been configured, no authentication is required.

In general, `TiUP` creates the user and group specified in the topology.yaml file on the target machine, with the following exceptions:
- The user name configured in `topology.yaml` already exists on the target machine.
- You have used the `--skip-create-user` option in the command line to explicitly skip the step of creating the user.

In the `tiup` cluster deploy command shown on the slide:
- `tidb-test` is the name of the `TiDB` cluster to be deployed.
- `v6.1.0` is the version of the `TiDB` cluster to be deployed. You can see the latest supported versions by running `tiup list tidb`.
- `topology.yaml` is the initialization configuration file.
- `--user root` indicates logging into the target machine as the root user to complete the cluster deployment. The root user is expected to have `ssh` and `sudo` privileges to the target machine. Alternatively, you can use other users with `ssh` and `sudo` privileges to complete the deployment. It does NOT have to be the OS root user.
- `-i` and `-p` are optional. If you have configured login to the target machine without password, these parameters are not required. If not, choose one of the two parameters. `[-i]` is the private key of the root user (or other users specified by `--user`) that has access to the target machine. `[-p]` is used to input the user password interactively.

At the end of the output log, you will see `Deployed cluster tidb-test successfully`. This indicates that the deployment is successful.
