TiDB database from entry to master series five: Install TiUP

TiDB database from entry to master series five: Install TiUP

1. Introduction to TiUP

In the installation management of various system software and application software, package managers are widely used. The emergence of package management tools greatly simplifies the installation, upgrade and maintenance of software. For example, almost all Linux using RPM will use yum for package management, and Anaconda can manage the Python environment and related packages very conveniently.

In the early TiDB ecosystem, there was no special package management tool, and users could only manage it manually through corresponding configuration files and folder naming. Third-party monitoring and reporting tools such as Prometheus even required additional special management, which greatly improved Difficulty in operation and maintenance management.

Starting from TiDB 4.0, TiUP, as a new tool, assumes the role of a package manager and manages many components in the TiDB ecosystem, such as TiDB, PD, TiKV, etc. When users want to run any component in the TiDB ecosystem, they only need to execute one line of TiUP commands, which greatly reduces the difficulty of management compared to before.

2. Install TiUP

The installation process of TiUP is very simple, whether it is Darwin or Linux operating system, just execute one line of command to install successfully:

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

This command installs TiUP in the $HOME/.tiup folder, and the components installed later and the data generated by running the components will also be placed in this folder. At the same time, it will automatically add $HOME/.tiup/bin to the PATH environment variable of the Shell Profile file, so that you can use TiUP directly.

For example, you can check the version of TiUP:

tiup --version

3. TiUP Ecosystem Introduction

The direct function of TiUP is to serve as a package manager in the TiDB ecosystem, but this is not its ultimate mission. The vision of TiUP is to minimize the barriers to use of all tools in the TiUP ecosystem. This cannot be achieved only by the package management function. It is also necessary to introduce some additional packages to enrich the system. They are added to the TiUP ecosystem together, so that The world of TiDB just got simpler.

The main content of the TiUP series of documents is to introduce the functions and usage of TiUP and these packages.

In the TiUP ecosystem, you can get help information by adding --help after 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
  -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 help information is longer, you can only focus on two parts:

available commands

  • install: used to install components
  • list: view the list of available components
  • uninstall: Uninstall the component
  • update: update the component version
  • status: View component running records
  • clean: clear component running records
  • mirror: Clone a private mirror from the official mirror
  • help: output help information

available components

  • playground: start the cluster locally
  • client: connect to the local cluster
  • cluster: Deploy the cluster for the production environment
  • bench: stress test the database

The difference between a command and a component is that the command comes with TiUP and is used for package management operations. Components are independent component packages installed by TiUP through package management operations. For example, if you execute the tiup list command, TiUP will directly run its own internal code, and if you execute the tiup playground command, it will first check whether there is a component package called playground locally. If not, it will download it from the mirror first, and then run the component package.

Guess you like

Origin blog.csdn.net/zhengzaifeidelushang/article/details/132308654