前期准备:
1、安装CentOS7.5,Linux版本要求:
Linux 操作系统平台 | 版本 |
---|---|
Red Hat Enterprise Linux | 7.3 及以上 |
CentOS | 7.3 及以上 |
Oracle Enterprise Linux | 7.3 及以上 |
Ubuntu LTS | 16.04 及以上 |
2、关闭swap
echo "vm.swappiness = 0">> /etc/sysctl.conf
swapoff -a && swapon -a
sysctl -p
3、关闭防火墙
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
sudo systemctl status firewalld.service
4、关闭selinux
cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
5、配置NTP服务
6、配置SSH互信及免密登录
7、安装numactl工具
正式安装:
1、在中控机上安装TiUP组件
1)在中控机安装TiUP工具
curl --proto '=https' --tlsv1.2 -sSf | sh
2)设置TiUP环境变量
source .bash_profile
3)确认TiUP是否安装过
which tiup
4)安装TiUP cluster组件
tiup cluster
5)更新TiUP cluster组件至最新版本
tiup update --self && tiup update cluster
6)查看TiUP版本信息
tiup --binary cluster
2 、初始化配置文件
包含最小拓扑的基础上,同时部署 TiFlash。TiFlash 是列式的存储引擎,已经逐步成为集群拓扑的标配。适合 Real-Time HTAP 业务。
# # Global variables are applied to all deployments and used as the default value of
# # the deployments if a specific deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/tidb/tidb-deploy"
data_dir: "/tidb/tidb-data"
# # Monitored variables are applied to all the machines.
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
server_configs:
tidb:
log.slow-threshold: 300
tikv:
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
pd:
replication.enable-placement-rules: true
tiflash:
logger.level: "info"
pd_servers:
- host: 172.16.254.92
- host: 172.16.254.93
- host: 172.16.254.94
tidb_servers:
- host: 172.16.254.95
- host: 172.16.254.96
- host: 172.16.254.97
tikv_servers:
- host: 172.16.254.98
- host: 172.16.254.99
- host: 172.16.254.100
tiflash_servers:
- host: 172.16.254.91
monitoring_servers:
- host: 172.16.254.91
grafana_servers:
- host: 172.16.254.91
alertmanager_servers:
- host: 172.16.254.91
查看可以安装的版本:
tiup list tidb
Available versions for tidb:
Version Installed Release Platforms
------- --------- ------- ---------
nightly 2021-02-20T10:22:06+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.0 2020-04-16T14:03:31+08:00 darwin/amd64,linux/amd64
v3.0 2020-04-16T16:58:06+08:00 darwin/amd64,linux/amd64
v3.0.1 2020-04-27T19:38:36+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.2 2020-04-16T23:55:11+08:00 darwin/amd64,linux/amd64
v3.0.3 2020-04-17T00:16:31+08:00 darwin/amd64,linux/amd64
v3.0.4 2020-04-17T00:22:46+08:00 darwin/amd64,linux/amd64
v3.0.5 2020-04-17T00:29:45+08:00 darwin/amd64,linux/amd64
v3.0.6 2020-04-17T00:39:33+08:00 darwin/amd64,linux/amd64
v3.0.7 2020-04-17T00:46:32+08:00 darwin/amd64,linux/amd64
v3.0.8 2020-04-17T00:54:19+08:00 darwin/amd64,linux/amd64
v3.0.9 2020-04-17T01:00:58+08:00 darwin/amd64,linux/amd64
v3.0.10 2020-03-13T14:11:53.774527401+08:00 darwin/amd64,linux/amd64
v3.0.11 2020-04-17T01:09:20+08:00 darwin/amd64,linux/amd64
v3.0.12 2020-04-17T01:16:04+08:00 darwin/amd64,linux/amd64
v3.0.13 2020-04-26T17:25:01+08:00 darwin/amd64,linux/amd64
v3.0.14 2020-05-09T21:11:49+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.15 2020-06-05T16:53:32+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.16 2020-07-03T20:07:45+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.17 2020-08-03T15:27:29+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.18 2020-08-21T20:02:59+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.19 2020-09-25T18:24:11+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.0.20 2020-12-25T15:20:36+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.0-beta 2020-05-22T14:35:59+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.0-beta.1 2020-05-22T15:22:30+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.0-beta.2 2020-05-22T15:28:20+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.0-rc 2020-05-22T15:56:23+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.0 2020-05-22T15:34:33+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.1 2020-04-30T21:02:32+08:00 darwin/amd64,linux/amd64,linux/arm64
v3.1.2 2020-06-04T17:55:40+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-beta 2020-05-26T11:18:05+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-beta.1 2020-05-26T11:42:48+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-beta.2 2020-05-26T11:56:51+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-rc 2020-05-26T14:56:06+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-rc.1 2020-04-29T01:03:31+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0-rc.2 2020-05-15T21:54:51+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.0 2020-05-28T20:10:11+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.1 2020-06-12T21:21:12+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.2 2020-07-01T19:59:39+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.3 2020-07-25T01:03:31+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.4 2020-07-31T16:44:42+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.5 2020-08-31T23:53:35+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.6 2020-09-15T22:13:29+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.7 2020-09-29T20:15:07+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.8 2020-10-30T19:30:22+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.9 2020-12-21T17:25:20+08:00 darwin/amd64,linux/amd64,linux/arm64
v4.0.10 2021-01-15T13:15:09+08:00 darwin/amd64,linux/amd64,linux/arm64
v5.0.0-rc 2021-01-12T23:40:27+08:00 darwin/amd64,linux/amd64,linux/arm64
在线部署
tiup cluster deploy hdcluster v4.0.8 ./topology.yaml --user root -p
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.3.2/tiup-cluster deploy hdcluster v4.0.8 ./topology.yaml --user root -p
Please confirm your topology:
Cluster type: tidb
Cluster name: hdcluster
Cluster version: v4.0.8
Type Host Ports OS/Arch Directories
---- ---- ----- ------- -----------
pd 172.16.254.92 2379/2380 linux/x86_64 /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
pd 172.16.254.93 2379/2380 linux/x86_64 /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
pd 172.16.254.94 2379/2380 linux/x86_64 /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
tikv 172.16.254.98 20160/20180 linux/x86_64 /tidb/tidb-deploy/tikv-20160,/tidb/tidb-data/tikv-20160
tikv 172.16.254.99 20160/20180 linux/x86_64 /tidb/tidb-deploy/tikv-20160,/tidb/tidb-data/tikv-20160
tikv 172.16.254.100 20160/20180 linux/x86_64 /tidb/tidb-deploy/tikv-20160,/tidb/tidb-data/tikv-20160
tidb 172.16.254.95 4000/10080 linux/x86_64 /tidb/tidb-deploy/tidb-4000
tidb 172.16.254.96 4000/10080 linux/x86_64 /tidb/tidb-deploy/tidb-4000
tidb 172.16.254.97 4000/10080 linux/x86_64 /tidb/tidb-deploy/tidb-4000
tiflash 172.16.254.91 9000/8123/3930/20170/20292/8234 linux/x86_64 /tidb/tidb-deploy/tiflash-9000,/tidb/tidb-data/tiflash-9000
prometheus 172.16.254.91 9090 linux/x86_64 /tidb/tidb-deploy/prometheus-9090,/tidb/tidb-data/prometheus-9090
grafana 172.16.254.91 3000 linux/x86_64 /tidb/tidb-deploy/grafana-3000
alertmanager 172.16.254.91 9093/9094 linux/x86_64 /tidb/tidb-deploy/alertmanager-9093,/tidb/tidb-data/alertmanager-9093
Attention:
1. If the topology is not what you expected, check your yaml file.
2. Please confirm there is no port/directory conflicts in same host.
Do you want to continue? [y/N]: y
Input SSH password:
+ Generate SSH keys ... Done
+ Download TiDB components
- Download pd:v4.0.8 (linux/amd64) ... Done
- Download tikv:v4.0.8 (linux/amd64) ... Done
- Download tidb:v4.0.8 (linux/amd64) ... Done
- Download tiflash:v4.0.8 (linux/amd64) ... Done
- Download prometheus:v4.0.8 (linux/amd64) ... Done
- Download grafana:v4.0.8 (linux/amd64) ... Done
- Download alertmanager:v0.17.0 (linux/amd64) ... Done
- Download node_exporter:v0.17.0 (linux/amd64) ... Done
- Download blackbox_exporter:v0.12.0 (linux/amd64) ... Done
+ Initialize target host environments
- Prepare 172.16.254.92:22 ... Done
- Prepare 172.16.254.93:22 ... Done
- Prepare 172.16.254.94:22 ... Done
- Prepare 172.16.254.98:22 ... Done
- Prepare 172.16.254.99:22 ... Done
- Prepare 172.16.254.100:22 ... Done
- Prepare 172.16.254.95:22 ... Done
- Prepare 172.16.254.96:22 ... Done
- Prepare 172.16.254.97:22 ... Done
- Prepare 172.16.254.91:22 ... Done
- Copy node_exporter -> 172.16.254.98 ... Done
- Copy node_exporter -> 172.16.254.96 ... Done
- Copy node_exporter -> 172.16.254.91 ... Done
- Copy node_exporter -> 172.16.254.93 ... Done
- Copy node_exporter -> 172.16.254.99 ... Done
- Copy node_exporter -> 172.16.254.100 ... Done
- Copy node_exporter -> 172.16.254.95 ... Done
- Copy node_exporter -> 172.16.254.97 ... Done
- Copy blackbox_exporter -> 172.16.254.94 ... Done
- Copy blackbox_exporter -> 172.16.254.98 ... Done
- Copy blackbox_exporter -> 172.16.254.96 ... Done
- Copy blackbox_exporter -> 172.16.254.92 ... Done
- Copy blackbox_exporter -> 172.16.254.99 ... Done
- Copy blackbox_exporter -> 172.16.254.100 ... Done
- Copy blackbox_exporter -> 172.16.254.95 ... Done
- Copy blackbox_exporter -> 172.16.254.97 ... Done
- Copy blackbox_exporter -> 172.16.254.91 ... Done
- Copy blackbox_exporter -> 172.16.254.93 ... Done
+ Check status
Enabling component pd
Enabling instance pd 172.16.254.94:2379
Enabling instance pd 172.16.254.92:2379
Enabling instance pd 172.16.254.93:2379
Enable pd 172.16.254.93:2379 success
Enable pd 172.16.254.92:2379 success
Enable pd 172.16.254.94:2379 success
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component tikv
Enabling instance tikv 172.16.254.100:20160
Enabling instance tikv 172.16.254.98:20160
Enabling instance tikv 172.16.254.99:20160
Enable tikv 172.16.254.98:20160 success
Enable tikv 172.16.254.100:20160 success
Enable tikv 172.16.254.99:20160 success
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component tidb
Enabling instance tidb 172.16.254.97:4000
Enabling instance tidb 172.16.254.95:4000
Enabling instance tidb 172.16.254.96:4000
Enable tidb 172.16.254.96:4000 success
Enable tidb 172.16.254.97:4000 success
Enable tidb 172.16.254.95:4000 success
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component tiflash
Enabling instance tiflash 172.16.254.91:9000
Enable tiflash 172.16.254.91:9000 success
Enabling component node_exporter
Enabling component blackbox_exporter
Enabling component prometheus
Enabling instance prometheus 172.16.254.91:9090
Enable prometheus 172.16.254.91:9090 success
Enabling component grafana
Enabling instance grafana 172.16.254.91:3000
Enable grafana 172.16.254.91:3000 success
Enabling component alertmanager
Enabling instance alertmanager 172.16.254.91:9093
Enable alertmanager 172.16.254.91:9093 success
Cluster `hdcluster` deployed successfully, you can start it with command: `tiup cluster start hdcluster`
查看TiUP管理的集群情况:
tiup cluster list
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.3.2/tiup-cluster list
Name User Version Path PrivateKey
---- ---- ------- ---- ----------
hdcluster tidb v4.0.8 /home/tidb/.tiup/storage/cluster/clusters/hdcluster /home/tidb/.tiup/storage/cluster/clusters/hdcluster/ssh/id_rsa
检查部署的TiUP集群情况
tiup cluster display hdcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.3.2/tiup-cluster display hdcluster
Cluster type: tidb
Cluster name: hdcluster
Cluster version: v4.0.8
SSH type: builtin
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
172.16.254.91:9093 alertmanager 172.16.254.91 9093/9094 linux/x86_64 inactive /tidb/tidb-data/alertmanager-9093 /tidb/tidb-deploy/alertmanager-9093
172.16.254.91:3000 grafana 172.16.254.91 3000 linux/x86_64 inactive - /tidb/tidb-deploy/grafana-3000
172.16.254.92:2379 pd 172.16.254.92 2379/2380 linux/x86_64 Down /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.93:2379 pd 172.16.254.93 2379/2380 linux/x86_64 Down /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.94:2379 pd 172.16.254.94 2379/2380 linux/x86_64 Down /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.91:9090 prometheus 172.16.254.91 9090 linux/x86_64 inactive /tidb/tidb-data/prometheus-9090 /tidb/tidb-deploy/prometheus-9090
172.16.254.95:4000 tidb 172.16.254.95 4000/10080 linux/x86_64 Down - /tidb/tidb-deploy/tidb-4000
172.16.254.96:4000 tidb 172.16.254.96 4000/10080 linux/x86_64 Down - /tidb/tidb-deploy/tidb-4000
172.16.254.97:4000 tidb 172.16.254.97 4000/10080 linux/x86_64 Down - /tidb/tidb-deploy/tidb-4000
172.16.254.91:9000 tiflash 172.16.254.91 9000/8123/3930/20170/20292/8234 linux/x86_64 N/A /tidb/tidb-data/tiflash-9000 /tidb/tidb-deploy/tiflash-9000
172.16.254.100:20160 tikv 172.16.254.100 20160/20180 linux/x86_64 N/A /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
172.16.254.98:20160 tikv 172.16.254.98 20160/20180 linux/x86_64 N/A /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
172.16.254.99:20160 tikv 172.16.254.99 20160/20180 linux/x86_64 N/A /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
Total nodes: 13
启动集群
tiup cluster start hdcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.3.2/tiup-cluster start hdcluster
Starting cluster hdcluster...
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/hdcluster/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/hdcluster/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.91
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.95
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.100
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.96
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.97
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.92
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.91
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.91
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.91
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.93
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.98
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.94
+ [Parallel] - UserSSH: user=tidb, host=172.16.254.99
+ [ Serial ] - StartCluster
Starting component pd
Starting instance pd 172.16.254.92:2379
Starting instance pd 172.16.254.93:2379
Starting instance pd 172.16.254.94:2379
Start pd 172.16.254.92:2379 success
Start pd 172.16.254.93:2379 success
Start pd 172.16.254.94:2379 success
Starting component node_exporter
Starting instance 172.16.254.92
Start 172.16.254.92 success
Starting component blackbox_exporter
Starting instance 172.16.254.92
Start 172.16.254.92 success
Starting component node_exporter
Starting instance 172.16.254.93
Start 172.16.254.93 success
Starting component blackbox_exporter
Starting instance 172.16.254.93
Start 172.16.254.93 success
Starting component node_exporter
Starting instance 172.16.254.94
Start 172.16.254.94 success
Starting component blackbox_exporter
Starting instance 172.16.254.94
Start 172.16.254.94 success
Starting component tikv
Starting instance tikv 172.16.254.100:20160
Starting instance tikv 172.16.254.98:20160
Starting instance tikv 172.16.254.99:20160
Start tikv 172.16.254.98:20160 success
Start tikv 172.16.254.100:20160 success
Start tikv 172.16.254.99:20160 success
Starting component node_exporter
Starting instance 172.16.254.98
Start 172.16.254.98 success
Starting component blackbox_exporter
Starting instance 172.16.254.98
Start 172.16.254.98 success
Starting component node_exporter
Starting instance 172.16.254.99
Start 172.16.254.99 success
Starting component blackbox_exporter
Starting instance 172.16.254.99
Start 172.16.254.99 success
Starting component node_exporter
Starting instance 172.16.254.100
Start 172.16.254.100 success
Starting component blackbox_exporter
Starting instance 172.16.254.100
Start 172.16.254.100 success
Starting component tidb
Starting instance tidb 172.16.254.97:4000
Starting instance tidb 172.16.254.95:4000
Starting instance tidb 172.16.254.96:4000
Start tidb 172.16.254.95:4000 success
Start tidb 172.16.254.96:4000 success
Start tidb 172.16.254.97:4000 success
Starting component node_exporter
Starting instance 172.16.254.95
Start 172.16.254.95 success
Starting component blackbox_exporter
Starting instance 172.16.254.95
Start 172.16.254.95 success
Starting component node_exporter
Starting instance 172.16.254.96
Start 172.16.254.96 success
Starting component blackbox_exporter
Starting instance 172.16.254.96
Start 172.16.254.96 success
Starting component node_exporter
Starting instance 172.16.254.97
Start 172.16.254.97 success
Starting component blackbox_exporter
Starting instance 172.16.254.97
Start 172.16.254.97 success
Starting component tiflash
Starting instance tiflash 172.16.254.91:9000
Start tiflash 172.16.254.91:9000 success
Starting component node_exporter
Starting instance 172.16.254.91
Start 172.16.254.91 success
Starting component blackbox_exporter
Starting instance 172.16.254.91
Start 172.16.254.91 success
Starting component prometheus
Starting instance prometheus 172.16.254.91:9090
Start prometheus 172.16.254.91:9090 success
Starting component grafana
Starting instance grafana 172.16.254.91:3000
Start grafana 172.16.254.91:3000 success
Starting component alertmanager
Starting instance alertmanager 172.16.254.91:9093
Start alertmanager 172.16.254.91:9093 success
+ [ Serial ] - UpdateTopology: cluster=hdcluster
Started cluster `hdcluster` successfully
可以看到集群已经启动成功。
查看集群状态
tiup cluster display hdcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.3.2/tiup-cluster display hdcluster
Cluster type: tidb
Cluster name: hdcluster
Cluster version: v4.0.8
SSH type: builtin
Dashboard URL:
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
172.16.254.91:9093 alertmanager 172.16.254.91 9093/9094 linux/x86_64 Up /tidb/tidb-data/alertmanager-9093 /tidb/tidb-deploy/alertmanager-9093
172.16.254.91:3000 grafana 172.16.254.91 3000 linux/x86_64 Up - /tidb/tidb-deploy/grafana-3000
172.16.254.92:2379 pd 172.16.254.92 2379/2380 linux/x86_64 Up|L /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.93:2379 pd 172.16.254.93 2379/2380 linux/x86_64 Up|UI /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.94:2379 pd 172.16.254.94 2379/2380 linux/x86_64 Up /tidb/tidb-data/pd-2379 /tidb/tidb-deploy/pd-2379
172.16.254.91:9090 prometheus 172.16.254.91 9090 linux/x86_64 Up /tidb/tidb-data/prometheus-9090 /tidb/tidb-deploy/prometheus-9090
172.16.254.95:4000 tidb 172.16.254.95 4000/10080 linux/x86_64 Up - /tidb/tidb-deploy/tidb-4000
172.16.254.96:4000 tidb 172.16.254.96 4000/10080 linux/x86_64 Up - /tidb/tidb-deploy/tidb-4000
172.16.254.97:4000 tidb 172.16.254.97 4000/10080 linux/x86_64 Up - /tidb/tidb-deploy/tidb-4000
172.16.254.91:9000 tiflash 172.16.254.91 9000/8123/3930/20170/20292/8234 linux/x86_64 Up /tidb/tidb-data/tiflash-9000 /tidb/tidb-deploy/tiflash-9000
172.16.254.100:20160 tikv 172.16.254.100 20160/20180 linux/x86_64 Up /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
172.16.254.98:20160 tikv 172.16.254.98 20160/20180 linux/x86_64 Up /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
172.16.254.99:20160 tikv 172.16.254.99 20160/20180 linux/x86_64 Up /tidb/tidb-data/tikv-20160 /tidb/tidb-deploy/tikv-20160
Total nodes: 13
可以看到所有的节点都是UP状态。
验证TiUP集群可用性
在172.16.254.95插入数据
mysql -uroot -P 4000 -h 172.16.254.95
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25-TiDB-v4.0.8 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database handong;
Query OK, 0 rows affected (1.07 sec)
mysql> use handong;
Database changed
mysql> create table t1(id int(10),name varchar(20));
Query OK, 0 rows affected (0.61 sec)
mysql> insert into t1 values(1,'handong');
Query OK, 1 row affected (0.06 sec)
在172.16.254.96进行查询
mysql -uroot -P 4000 -h 172.16.254.96
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25-TiDB-v4.0.8 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA |
| PERFORMANCE_SCHEMA |
| handong |
| mysql |
| test |
+--------------------+
6 rows in set (0.00 sec)
mysql> use handong;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1;
+------+---------+
| id | name |
+------+---------+
| 1 | handong |
+------+---------+
1 row in set (0.01 sec)
在 172.16.254.97进行查询
mysql -uroot -P 4000 -h 172.16.254.97
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.25-TiDB-v4.0.8 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA |
| PERFORMANCE_SCHEMA |
| handong |
| mysql |
| test |
+--------------------+
6 rows in set (0.01 sec)
mysql> use handong;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1;
+------+---------+
| id | name |
+------+---------+
| 1 | handong |
+------+---------+
1 row in set (0.02 sec)
参考官方文档: