is a cluster operation and maintenance tool. TiUP provides TiUP cluster, a cluster management component written in Golang. By using TiUP cluster, you can easily do daily operations, including deploying, starting, stopping, destroying, scaling, and upgrading a TiKV cluster, and manage cluster parameters.
Log in to the control machine using a regular user account (take the user as an example). All the following TiUP installation and cluster management operations can be performed by the tikv
user.
Install TiUP by executing the following command:
Set the TiUP environment variables:
Redeclare the global environment variables:
source .bash_profile
Confirm whether TiUP is installed:
tiup
Install the TiUP cluster component:
tiup cluster
Verify the current version of your TiUP cluster:
tiup --binary cluster
Step 2: Initialize cluster topology file
According to the intended cluster topology, you need to manually create and edit the cluster initialization configuration file.
To create the cluster initialization configuration file, you can create a YAML-formatted configuration file on the control machine using TiUP:
tiup cluster template > topology.yaml
Execute vi topology.yaml
to edit the configuration file content:
user: "tikv"
ssh_port: 22
deploy_dir: "/tikv-deploy"
data_dir: "/tikv-data"
server_configs: {}
pd_servers:
- host: 10.0.1.1
- host: 10.0.1.2
- host: 10.0.1.3
tikv_servers:
- host: 10.0.1.4
- host: 10.0.1.6
monitoring_servers:
- host: 10.0.1.7
grafana_servers:
- For parameters that should be globally effective, configure these parameters of corresponding components in the
server_configs
section of the configuration file. - For parameters that should be effective on a specific node, configure these parameters in the
config
of this node. - Use
.
to indicate the subcategory of the configuration, such asstorage.scheduler-concurrency
. For more formats, see . - For more parameter description, see TiKV config.toml.example, configuration.
You can use secret keys or interactive passwords for security authentication when you deploy TiKV using TiUP:
- If you use secret keys, you can specify the path of the keys through
-i
or--identity_file
; - If you use passwords, add the
-p
flag to enter the password interaction window; - If password-free login to the target machine has been configured, no authentication is required.
In general, TiUP creates the user and group specified in the topology.yaml
file on the target machine, with the following exceptions:
- The user name configured in
topology.yaml
already exists on the target machine. - You have used the
--skip-create-user
option in the command line to explicitly skip the step of creating the user.
Before you execute the deploy
command, use the check
and check --apply
commands to detect and automatically repair the potential risks in the cluster:
In the above command:
- The name of the deployed TiKV cluster is
tikv-test
. - You can see the latest supported versions by running
tiup list tikv
. This document takesv5.0.1
as an example. - The initialization configuration file is
topology.yaml
. --user root
: Log in to the target machine through theroot
key to complete the cluster deployment, or you can use other users withssh
andsudo
privileges to complete the deployment.[-i]
and[-p]
: optional. If you have configured login to the target machine without password, these parameters are not required. If not, choose one of the two parameters.[-i]
is the private key of theroot
user (or other users specified by--user
) that has access to the target machine.[-p]
is used to input the user password interactively.- If you need to specify the user group name to be created on the target machine, see .
At the end of the output log, you will see Deployed cluster `tikv-test` successfully
. This indicates that the deployment is successful.
Step 4: Check the clusters managed by TiUP
TiUP supports managing multiple TiKV clusters. The command above outputs information of all the clusters currently managed by TiUP, including the name, deployment user, version, and secret key information.
For example, execute the following command to check the status of the tikv-test
cluster:
tiup cluster display tikv-test
Expected output includes the instance ID, role, host, listening port, and status (because the cluster is not started yet, so the status is Down
/), and directory information.
Step 6: Start the TiKV cluster
If the output log includes Started cluster `tikv-test` successfully
, the deployment is successful.
For the specific operations, see Verify Cluster Status.