diff --git a/tiup/tiup-cluster.md b/tiup/tiup-cluster.md index 48335bbc25011..eb39fc11fa892 100644 --- a/tiup/tiup-cluster.md +++ b/tiup/tiup-cluster.md @@ -567,3 +567,41 @@ For example, if you previously view the store by running `pd-ctl -u http://127.0 ```bash tiup ctl pd -u http://127.0.0.1:2379 store ``` + +## Environment checks for target machines + +You can use the `check` command to perform a series of checks on the environment of the target machine and output the check results. By executing the `check` command, you can find common unreasonable configurations or unsupported situations. The command flag list is as follows: + +```bash +Usage: + tiup cluster check [flags] +Flags: + --apply Try to fix failed checks + --cluster Check existing cluster, the input is a cluster name. + --enable-cpu Enable CPU thread count check + --enable-disk Enable disk IO (fio) check + --enable-mem Enable memory size check + -h, --help help for check + -i, --identity_file string The path of the SSH identity file. If specified, public key authentication will be used. + -p, --password Use password of target hosts. If specified, password authentication will be used. + --user string The user name to login via SSH. The user must has root (or sudo) privilege. +``` + +By default, this command is used to check the environment before deployment. By specifying the `--cluster` flag to switch the mode, you can also check the target machines of an existing cluster, for example: + +```bash +# check deployed servers before deployment +tiup cluster check topology.yml --user tidb -p +# check deployed servers of an existing cluster +tiup cluster check --cluster +``` + +The CPU thread count check, memory size check, and disk performance check are disabled by default. For the production environment, it is recommended that you enable the three checks and make sure they pass to obtain the best performance. + +- CPU: If the number of threads is greater than or equal to 16, the check is passed. +- Memory: If the total size of physical memory is greater than or equal to 32 GB, the check is passed. +- Disk: Execute `fio` test on the partitions of `data_dir` and record the results. + +When running the checks, if the `--apply` flag is specified, the program automatically repairs the failed items. Automatic repair is limited to some items that can be adjusted by modifying the configuration or system parameters. Other unrepaired items need to be handled manually according to the actual situation. + +Environment checks are not necessary for deploying a cluster. For the production environment, it is recommended to perform environment checks and pass all check items before deployment. If not all the check items are passed, the cluster might be deployed and run normally, but the best performance might not be obtained.