Installing TiUP
What Is TiUP?
- TiUP is a cluster operation and maintenance tool introduced in TiDB 4.0.
- TiUP provides TiUP Cluster, a cluster management component written in Golang.
- With TiUP Cluster, you can easily perform routine database operations such as deploying, starting, stopping, deleting, scaling, and upgrading TiDB clusters, and you can manage TiDB cluster parameters.
Installing TiUP on Linux
1. Download and install the TiUP tool
First, run the following command in an online environment to download and install TiUP.
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
If a “Successfully” message like the following appears, TiUP has been installed successfully.
[kimkc@localhost ~]$ curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7085k 100 7085k 0 0 3326k 0 0:00:02 0:00:02 --:--:-- 3328k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /home/kimkc/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile: /home/kimkc/.bash_profile
/home/kimkc/.bash_profile has been modified to add tiup to PATH
open a new terminal or source /home/kimkc/.bash_profile to use it
Installed path: /home/kimkc/.tiup/bin/tiup
===============================================
Have a try: tiup playground
===============================================
[kimkc@localhost ~]$
Remember the installed shell profile path shown in the output above. You need to use this path in the next step.
Installed path: /home/kimkc/.tiup/bin/tiup
2. Apply the changed environment variables
After installation, if you list the home directory as shown below, you can see that the .pki and .tiup directories have been created.
[kimkc@localhost ~]$ ls -al
total 16
drwx------. 4 kimkc kimkc 108 Oct 31 11:08 .
drwxr-xr-x. 3 root root 19 Oct 31 2022 ..
-rw-------. 1 kimkc kimkc 282 Oct 31 10:51 .bash_history
-rw-r--r--. 1 kimkc kimkc 18 Mar 31 2020 .bash_logout
-rw-r--r--. 1 kimkc kimkc 234 Oct 31 11:08 .bash_profile
-rw-r--r--. 1 kimkc kimkc 231 Mar 31 2020 .bashrc
drwxrw----. 3 kimkc kimkc 19 Oct 31 11:07 .pki
drwxrwxr-x. 3 kimkc kimkc 34 Oct 31 11:08 .tiup
[kimkc@localhost ~]$
If you check the shell profile file, .bash_profile, you can see that the .tiup/bin path has been registered in PATH.
[kimkc@localhost ~]$ cat .bash_profile
# .bash_profile
# ... omitted ...
export PATH=/home/kimkc/.tiup/bin:$PATH
Apply the changed environment variables with the source command.
$ source .bash_profile
Installing TiUP on macOS
1. Download and install the TiUP tool
First, run the following command in an online environment to download and install TiUP.
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
% curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6988k 100 6988k 0 0 3433k 0 0:00:02 0:00:02 --:--:-- 3442k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /Users/user/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: zsh
Shell profile: /Users/user/.zshrc
/Users/user/.zshrc has been modified to add tiup to PATH
open a new terminal or source /Users/user/.zshrc to use it
Installed path: /Users/user/.tiup/bin/tiup
===============================================
Have a try: tiup playground
===============================================
2. Declare the global environment variables again
After installation, TiUP displays the absolute path of the corresponding shell profile file. Depending on the path, replace ${your_shell_profile} in the following source command. In this case, ${your_shell_profile} from the output in step 1 is /Users/user/.zshrc.
source ${your_shell_profile}
% source .zshrc
3. Check whether TiUP is installed
which tiup
% which tiup
/Users/user/.tiup/bin/tiup
- Declare the global environment variables.