Skip to content

Commit 872761d

Browse files
TomShawnran-huang
andauthored
Add document for tiup-cluster (pingcap#3778)
* Add document for tiup-cluster * Update tiup-cluster.md * Update tiup/tiup-cluster.md Co-authored-by: Ran <[email protected]>
1 parent a81d86b commit 872761d

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

maintain-tidb-using-tiup.md

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ Flags:
159159
--transfer-timeout int Timeout in seconds when transferring PD and TiKV store leaders (default 300)
160160
161161
Global Flags:
162+
163+
--native-ssh Use the system's native SSH client
164+
--wait-timeout int Timeout of waiting the operation
162165
--ssh-timeout int Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
163166
-y, --yes Skip all confirmations and assumes 'yes'
164167
```

tiup/tiup-cluster.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Available Commands:
4949
5050
Flags:
5151
-h, --help help for cluster
52+
--native-ssh Use the system's native SSH client
53+
--wait-timeout int Timeout of waiting the operation
5254
--ssh-timeout int Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
5355
-y, --yes Skip all confirmations and assumes 'yes'
5456
```
@@ -351,6 +353,8 @@ Flags:
351353
--transfer-timeout int Timeout in seconds when transferring PD and TiKV store leaders (default 300)
352354
353355
Global Flags:
356+
--native-ssh Use the system's native SSH client
357+
--wait-timeout int Timeout of waiting the operation
354358
--ssh-timeout int Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
355359
-y, --yes Skip all confirmations and assumes 'yes'
356360
```
@@ -409,6 +413,8 @@ Flags:
409413
--transfer-timeout int Timeout in seconds when transferring PD and TiKV store leaders (default 300)
410414

411415
Global Flags:
416+
--native-ssh Use the system's native SSH client
417+
--wait-timeout int Timeout of waiting the operation
412418
--ssh-timeout int Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
413419
-y, --yes Skip all confirmations and assumes 'yes'
414420
```
@@ -459,6 +465,8 @@ Flags:
459465
-r, --rename NAME Rename the imported cluster to NAME
460466
461467
Global Flags:
468+
--native-ssh Use the system's native SSH client
469+
--wait-timeout int Timeout of waiting the operation
462470
--ssh-timeout int Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
463471
-y, --yes Skip all confirmations and assumes 'yes'
464472
```
@@ -613,6 +621,37 @@ When running the checks, if the `--apply` flag is specified, the program automat
613621
614622
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.
615623
624+
## Use the system's native SSH client to connect to cluster
625+
626+
All operations above performed on the cluster machine use the SSH client embedded in TiUP to connect to the cluster and execute commands. However, in some scenarios, you might also need to use the SSH client native to the control machine system to perform such cluster operations. For example:
627+
628+
- To use a SSH plug-in for authentication
629+
- To use a customized SSH client
630+
631+
Then you can use the `--native-ssh` command-line flag to enable the system-native command-line tool:
632+
633+
- Deploy a cluster: `tiup cluster deploy <cluster-name> <version> <topo> --native-ssh`
634+
- Start a cluster: `tiup cluster start <cluster-name> --native-ssh`
635+
- Upgrade a cluster: `tiup cluster upgrade ... --native-ssh`
636+
637+
You can add `--native-ssh` in all cluster operation commands above to use the system's native SSH client.
638+
639+
To avoid adding such a flag in every command, you can use the `TIUP_NATIVE_SSH` system variable to specify whether to use the local SSH client:
640+
641+
```sh
642+
export TIUP_NATIVE_SSH=true
643+
# or
644+
export TIUP_NATIVE_SSH=1
645+
# or
646+
export TIUP_NATIVE_SSH=enable
647+
```
648+
649+
If you specify this environment variable and `--native-ssh` at the same time, `--native-ssh` has higher priority.
650+
651+
> **Note:**
652+
>
653+
> During the process of cluster deployment, if you need to use a password for connection (`-p`) or `passphrase` is configured in the key file, you must ensure that `sshpass` is installed on the control machine; otherwise, a timeout error is reported.
654+
616655
## Migrate control machine and back up TiUP data
617656
618657
The TiUP data is stored in the `.tiup` directory in the user's home directory. To migrate the control machine, you can take the following steps to copy the `.tiup` directory to the corresponding target machine:
@@ -626,4 +665,4 @@ The TiUP data is stored in the `.tiup` directory in the user's home directory. T
626665

627666
> **Note:**
628667
>
629-
> It is recommended that you back up the `.tiup` directory regularly to avoid the loss of TiUP data caused by abnormal conditions, such as disk damage of the control machine.
668+
> It is recommended that you back up the `.tiup` directory regularly to avoid the loss of TiUP data caused by abnormal conditions, such as disk damage of the control machine.

0 commit comments

Comments
 (0)