TiUP Overview

Starting with TiDB 4.0, TiUP, as the package manager, makes it far easier to manage different cluster components in the TiDB ecosystem. Now you can run any component with only a single line of TiUP commands.

Install TiUP

You can install TiUP with a single command in both Darwin and Linux operating systems:

curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

This command installs TiUP in the $HOME/.tiup folder. The installed components and the data generated by their operation are also placed in this folder. This command also automatically adds $HOME/.tiup/bin to the PATH environment variable in the Shell .profile file, so you can use TiUP directly.

After installation, you can check the version of TiUP:

tiup --version

TiUP ecosystem introduction

TiUP is not only a package manager in the TiDB ecosystem. Its ultimate mission is to enable everyone to use TiDB ecosystem tools easier than ever before by building its own ecosystem. This requires introducing additional packages to enrich the TiUP ecosystem.

This series of TiUP documents introduce what these packages do and how you can use them.

In the TiUP ecosystem, you can get help information by adding --help to any command, such as the following command to get help information for TiUP itself:

tiup --help
TiUP is a command-line component management tool that can help to download and install TiDB platform components to the local system. You can run a specific version of a component via "tiup <component>[:version]". If no version number is specified, the latest version installed locally will be used. If the specified component does not have any version installed locally, the latest stable version will be downloaded from the repository. Usage: tiup [flags] <command> [args...] tiup [flags] <component> [args...] Available Commands: install Install a specific version of a component list List the available TiDB components or versions uninstall Uninstall components or versions of a component update Update tiup components to the latest version status List the status of instantiated components clean Clean the data of instantiated components mirror Manage a repository mirror for TiUP components help Help about any command or component Components Manifest: use "tiup list" to fetch the latest components manifest Flags: --binary <component>[:version] Print binary path of a specific version of a component <component>[:version] and the latest version installed will be selected if no version specified --binpath string Specify the binary path of component instance -h, --help help for tiup --skip-version-check Skip the strict version check, by default a version must be a valid SemVer string -T, --tag string Specify a tag for component instance -v, --version version for tiup Component instances with the same "tag" will share a data directory ($TIUP_HOME/data/$tag): $ tiup --tag mycluster playground Examples: $ tiup playground # Quick start $ tiup playground nightly # Start a playground with the latest nightly version $ tiup install <component>[:version] # Install a component of specific version $ tiup update --all # Update all installed components to the latest version $ tiup update --nightly # Update all installed components to the nightly version $ tiup update --self # Update the "tiup" to the latest version $ tiup list # Fetch the latest supported components list $ tiup status # Display all running/terminated instances $ tiup clean <name> # Clean the data of running/terminated instance (Kill process if it's running) $ tiup clean --all # Clean the data of all running/terminated instances Use "tiup [command] --help" for more information about a command.

The output is long but you can focus on only two parts:

  • Available commands
    • install: used to install components
    • list: used to view the list of available components
    • uninstall: used to uninstall components
    • update: used to update the component version
    • status: used to view the running history of components
    • clean: used to clear the running log of components
    • mirror: used to clone a private mirror from the official mirror
    • help: used to print out help information
  • Available components
    • playground: used to start a TiDB cluster locally
    • client: used to connect to a TiDB cluster in a local machine
    • cluster: used to deploy a TiDB cluster for production environments
    • bench: used to stress test the database

TiUP commands are implemented in TiUP's internal code and used for package management operations, while TiUP components are independent component packages installed by TiUP commands.

For example, if you run the tiup list command, TiUP directly runs its own internal code; if you run the tiup playground command, TiUP first checks whether there is a local package named "playground", and if not, TiUP downloads the package from the mirror, and then run it.