TiUP Overview

Package manager or package management system is widely used to automate the process of installing and managing system software and application software. Package management tools greatly simplify software's installation, upgrade, and maintenance processes. For example, almost all Linux operating systems that use RPM use Yum for package management, while Anaconda makes it very easy to manage the Python environment and related packages.

In the past, there was no dedicated package management tool in the TiDB ecosystem. Users could only manually manage various packages through different configuration files and folders. Some third-party monitoring and reporting tools such as Prometheus even required additional special management, which made the operation and maintenance work much more difficult.

Starting with TiDB 4.0, TiUP, as a new tool, assumes the role of a package manager and is responsible for managing components in the TiDB ecosystem, such as TiDB, PD, TiKV, and so on. When you want to run any component in the TiDB ecosystem, you just need to execute a single line of TiUP commands, which is far easier to manage.

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
  help        Help about any command or component

Available Components:
  playground          Bootstrap a local TiDB cluster
  client              A simple mysql client to connect TiDB
  package             A toolbox to package tiup component
  cluster             Deploy a TiDB cluster for production
  mirrors             Build a local mirrors and download all selected components
  bench               Benchmark database with different workloads
  doc                 Online document for TiDB

Flags:
  -B, --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
      --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 --refresh                # 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
    • 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
    • mirrors: used to clone a private mirror from an official mirror
    • cluster: used to deploy a TiDB cluster for production environments
    • package: used to package a new TiUP component
    • bench: used to stress test the database
    • doc: used to open online document

Note:

  • The number of available components will continue to grow. To check the latest supported components, execute the tiup list --refresh command.
  • The list of available versions of components will also continue to grow. To check the latest supported component versions, execute the tiup list <component> --refresh command.

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.

All TiUP commands are described in Manage TiUP Components with TiUP Commands. All TiUP components are divided into the following topics by component: