马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
0,集群节点以及脚色
TiDB的集群有多种架构,除了用于测试体验的“摆设本地测试集群”和“在单机上模仿摆设生产情况集群”之外,参考官方文档,顺应于天生情况的集群,基于最小拓扑架构集群的TIDB安装,呆板的IP地点以及脚色分配如下:
1,节点脚色如下,1个Monitor节点+2个TIDB节点+3个PD节点+3个TiKV节点,一共9个节点
实例个数物理机设置IP设置TiDB216 VCore 32 GiB
100 GiB 用于存储192.168.152.132
192.168.152.133默认端口
全局目次设置PD34 VCore 8 GiB
100 GiB 用于存储192.168.152.126
192.168.152.127
192.168.152.128默认端口
全局目次设置TiKV316 VCore 32 GiB
2 TiB (NVMe SSD) 用于存储192.168.152.129
192.168.152.130
192.168.152.131默认端口
全局目次设置Monitoring & Grafana14 VCore 8 GiB
500 GiB (SSD) 用于存储192.168.152.134默认端口
全局目次设置2,本文情况涉及到的主机与IP如下:
192.168.152.126 ubuntu16
192.168.152.127 ubuntu17
192.168.152.128 ubuntu18
192.168.152.129 ubuntu19
192.168.152.130 ubuntu20
192.168.152.131 ubuntu21
192.168.152.132 ubuntu22
192.168.152.133 ubuntu23
192.168.152.134 ubuntu24
1,SSH互信设置
1,恣意两台之间要设置为SSH互信,过程略,由于这里涉及较多的呆板,恣意两台之间都要相互信托,传统手动设置起来非法贫苦,这里就八仙过海各显神通,可以接种AI天生各种骚脚原来实现,这里不是本文的重点2,修改 /etc/ssh/sshd_config 将 MaxSessions 调至 20大概更高,然后重启sshd服务。- root@ubuntu15:~# vi /etc/ssh/sshd_config
- root@ubuntu15:~#
- root@ubuntu15:~# service sshd restart
复制代码
2,TiUP 安装
2.1 TiUP是做什么的?
一句话:TiUP是TiBD的主动化安装下令。
TiUP 对于 TiDB 生态,就犹如 yum之与 CentOS/RHEL ,或 apt 之与 Ubuntu 利用体系。它们都扮演着包管理器(Package Manager)的核心脚色,办理了软件摆设和管理的三个关键标题:下载、安装、依靠管理。
2.2 TiUP安装位置?
TiUP可以安装在集群呆板中的恣意一台上,这里安装在Monitoring Server上,也即ubuntu24上,从ubuntu24上发起集群的创建,以下全部的利用都在ubuntu24上实验
TiUP安装下令:curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh- root@ubuntu24:~# curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 100 4709k 100 4709k 0 0 5836k 0 --:--:-- --:--:-- --:--:-- 5829k
- Successfully set mirror to https://tiup-mirrors.pingcap.com
- Detected shell: bash
- Shell profile: /root/.bashrc
- /root/.bashrc has been modified to add tiup to PATH
- open a new terminal or source /root/.bashrc to use it
- Installed path: /root/.tiup/bin/tiup
- ===============================================
- Have a try: tiup playground
- ===============================================
- root@ubuntu24:~#
复制代码 革新情况变量- root@ubuntu24:~# source /root/.bashrc
复制代码
3,安装 TiUP Cluster
TiUP Cluster是什么?专门用于生产情况 TiDB 集群的摆设和运维管理,TiUP Cluster 可以以为是 TiUP 工具包中的一个核心子集(或子下令)。
安装下令:tiup cluster- root@ubuntu24:~# tiup cluster
- Checking updates for component cluster... Timedout (after 2s)
- The component `cluster` version is not installed; downloading from repository.
- download https://tiup-mirrors.pingcap.com/cluster-v1.16.5-linux-amd64.tar.gz 9.76 MiB / 9.76 MiB 100.00% 16.89 MiB/s
- Deploy a TiDB cluster for production
- Usage:
- tiup cluster [command]
- Available Commands:
- check Perform preflight checks for the cluster.
- deploy Deploy a cluster for production
- start Start a TiDB cluster
- stop Stop a TiDB cluster
- restart Restart a TiDB cluster
- scale-in Scale in a TiDB cluster
- scale-out Scale out a TiDB cluster
- destroy Destroy a specified cluster
- clean (EXPERIMENTAL) Cleanup a specified cluster
- upgrade Upgrade a specified TiDB cluster
- display Display information of a TiDB cluster
- prune Destroy and remove instances that is in tombstone state
- list List all clusters
- audit Show audit log of cluster operation
- edit-config Edit TiDB cluster config
- show-config Show TiDB cluster config
- reload Reload a TiDB cluster's config and restart if needed
- patch Replace the remote package with a specified package and restart the service
- rename Rename the cluster
- enable Enable a TiDB cluster automatically at boot
- disable Disable automatic enabling of TiDB clusters at boot
- replay Replay previous operation and skip successed steps
- template Print topology template
- tls Enable/Disable TLS between TiDB components
- meta backup/restore meta information
- rotatessh rotate ssh keys on all nodes
- help Help about any command
- completion Generate the autocompletion script for the specified shell
- Flags:
- -c, --concurrency int max number of parallel tasks allowed (default 5)
- --format string (EXPERIMENTAL) The format of output, available values are [default, json] (default "default")
- -h, --help help for tiup
- --profile-dir string Write cpu/heap pprof profiles into this directory
- --ssh string (EXPERIMENTAL) The executor type: 'builtin', 'system', 'none' (default "builtin").
- --ssh-timeout uint Timeout in seconds to connect host via SSH, ignored for operations that don't need an SSH connection. (default 5)
- -v, --version version for tiup
- --wait-timeout uint Timeout in seconds to wait for an operation to complete, ignored for operations that don't fit. (default 120)
- -y, --yes Skip all confirmations and assumes 'yes'
- Use "tiup cluster help [command]" for more information about a command.
- root@ubuntu24:~#
复制代码
4, 编写集群设置文件
1,集群设置文件的作用?
引导集群的搭建以及脚色分配,集群设置文件中指定了集群中的脚色对应的主机IP,相当于提前指定好集群中每个节点的脚色,目标是创建集群是引导文件,而不是集群运行的引导文件。
2,集群设置文件的位置?
上面提到“以下全部的利用都在ubuntu24上实验”,这里将设置文件放在ubuntu24下的/TiDB/topo.ymal(topo寄义为拓扑),如下- # # 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-deploy"
- data_dir: "/tidb-data"
- pd_servers:
- - host: 192.168.152.126
- - host: 192.168.152.127
- - host: 192.168.152.128
- tidb_servers:
- - host: 192.168.152.132
- - host: 192.168.152.133
- tikv_servers:
- - host: 192.168.152.129
- - host: 192.168.152.130
- - host: 192.168.152.131
- monitoring_servers:
- - host: 192.168.152.134
- grafana_servers:
- - host: 192.168.152.134
- alertmanager_servers:
- - host: 192.168.152.134
复制代码
5,TiDB集群安装
安装版本检察:tiup list tidb检察可供安装的TiDB集群版本,有上百个可用安装的版本可选。- root@ubuntu24:~# tiup list tidb
- Available versions for tidb:
- Version Installed Release Platforms
- ------- --------- ------- ---------
- nightly -> v9.0.0-beta.2.pre-nightly 2026-05-06T01:52:33Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- 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 linux/arm64,darwin/amd64,linux/amd64
- 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
- ………………略
- v8.5.3 2025-08-14T10:25:28Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- v8.5.4 2025-11-27T07:56:43Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- v8.5.5 2026-03-23T14:15:12Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- v8.5.6 2026-04-14T10:10:57Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- v9.0.0-beta.1 2025-03-31T04:58:34Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- v9.0.0-beta.2.pre-nightly 2026-05-06T01:52:33Z linux/arm64,darwin/amd64,darwin/arm64,linux/amd64
- root@ubuntu24:~#
复制代码 这安装最新的稳固版v8.5.6,集群定名为TiDBCluster ,下令如下
tiup cluster deploy TiDBCluster v8.5.6 /TiDB/topo.yaml --user root -p,安装过程会主动再各个节点上创建对应的目次,然后下载对应的安装包,末了主动安装- root@ubuntu24:~# tiup cluster deploy TiDBCluster v8.5.6 /TiDB/topo.yaml --user root -p
- Input SSH password:
- + Detect CPU Arch Name
- - Detecting node 192.168.152.126 Arch info ... ⠏ Shell: host=192.168.152.126, sudo=false, command=`uname -m`
- - Detecting node 192.168.152.127 Arch info ... ⠏ Shell: host=192.168.152.127, sudo=false, command=`uname -m`
- - Detecting node 192.168.152.128 Arch info ... ⠏ Shell: host=192.168.152.128, sudo=false, command=`uname -m`
- + Detect CPU Arch Name
- - Detecting node 192.168.152.126 Arch info ... Done
- - Detecting node 192.168.152.127 Arch info ... Done
- - Detecting node 192.168.152.128 Arch info ... Done
- - Detecting node 192.168.152.129 Arch info ... Done
- - Detecting node 192.168.152.130 Arch info ... Done
- - Detecting node 192.168.152.131 Arch info ... Done
- - Detecting node 192.168.152.132 Arch info ... Done
- - Detecting node 192.168.152.133 Arch info ... Done
- - Detecting node 192.168.152.134 Arch info ... Done
- + Detect CPU OS Name
- + Detect CPU OS Name
- - Detecting node 192.168.152.126 OS info ... ⠏ Shell: host=192.168.152.126, sudo=false, command=`uname -s`
- - Detecting node 192.168.152.127 OS info ... ⠏ Shell: host=192.168.152.127, sudo=false, command=`uname -s`
- + Detect CPU OS Name
- - Detecting node 192.168.152.126 OS info ... Done
- - Detecting node 192.168.152.127 OS info ... Done
- - Detecting node 192.168.152.128 OS info ... Done
- - Detecting node 192.168.152.129 OS info ... Done
- - Detecting node 192.168.152.130 OS info ... Done
- - Detecting node 192.168.152.131 OS info ... Done
- - Detecting node 192.168.152.132 OS info ... Done
- - Detecting node 192.168.152.133 OS info ... Done
- - Detecting node 192.168.152.134 OS info ... Done
- Please confirm your topology:
- Cluster type: tidb
- Cluster name: TiDBCluster
- Cluster version: v8.5.6
- Role Host Ports OS/Arch Directories
- ---- ---- ----- ------- -----------
- pd 192.168.152.126 2379/2380 linux/x86_64 /tidb-deploy/pd-2379,/tidb-data/pd-2379
- pd 192.168.152.127 2379/2380 linux/x86_64 /tidb-deploy/pd-2379,/tidb-data/pd-2379
- pd 192.168.152.128 2379/2380 linux/x86_64 /tidb-deploy/pd-2379,/tidb-data/pd-2379
- tikv 192.168.152.129 20160/20180 linux/x86_64 /tidb-deploy/tikv-20160,/tidb-data/tikv-20160
- tikv 192.168.152.130 20160/20180 linux/x86_64 /tidb-deploy/tikv-20160,/tidb-data/tikv-20160
- tikv 192.168.152.131 20160/20180 linux/x86_64 /tidb-deploy/tikv-20160,/tidb-data/tikv-20160
- tidb 192.168.152.132 4000/10080 linux/x86_64 /tidb-deploy/tidb-4000
- tidb 192.168.152.133 4000/10080 linux/x86_64 /tidb-deploy/tidb-4000
- prometheus 192.168.152.134 9090/9115/9100/12020 linux/x86_64 /tidb-deploy/prometheus-9090,/tidb-data/prometheus-9090
- grafana 192.168.152.134 3000 linux/x86_64 /tidb-deploy/grafana-3000
- alertmanager 192.168.152.134 9093/9094 linux/x86_64 /tidb-deploy/alertmanager-9093,/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]: (default=N) y
- + Generate SSH keys ... Done
- + Download TiDB components
- + Download TiDB components
- + Download TiDB components
- + Download TiDB components
- - Download pd:v8.5.6 (linux/amd64) ... Done
- - Download tikv:v8.5.6 (linux/amd64) ... Done
- - Download tidb:v8.5.6 (linux/amd64) ... Done
- - Download prometheus:v8.5.6 (linux/amd64) ... Done
- - Download grafana:v8.5.6 (linux/amd64) ... Done
- - Download alertmanager: (linux/amd64) ... Done
- - Download node_exporter: (linux/amd64) ... Done
- - Download blackbox_exporter: (linux/amd64) ... Done
- + Initialize target host environments
- - Prepare 192.168.152.130:22 ... Done
- - Prepare 192.168.152.132:22 ... Done
- - Prepare 192.168.152.133:22 ... Done
- - Prepare 192.168.152.134:22 ... Done
- - Prepare 192.168.152.128:22 ... Done
- - Prepare 192.168.152.129:22 ... Done
- - Prepare 192.168.152.131:22 ... Done
- - Prepare 192.168.152.126:22 ... Done
- - Prepare 192.168.152.127:22 ... Done
- + Deploy TiDB instance
- - Copy pd -> 192.168.152.126 ... Done
- - Copy pd -> 192.168.152.127 ... Done
- - Copy pd -> 192.168.152.128 ... Done
- - Copy tikv -> 192.168.152.129 ... Done
- - Copy tikv -> 192.168.152.130 ... Done
- - Copy tikv -> 192.168.152.131 ... Done
- - Copy tidb -> 192.168.152.132 ... Done
- - Copy tidb -> 192.168.152.133 ... Done
- - Copy prometheus -> 192.168.152.134 ... Done
- - Copy grafana -> 192.168.152.134 ... Done
- - Copy alertmanager -> 192.168.152.134 ... Done
- - Deploy node_exporter -> 192.168.152.126 ... Done
- - Deploy node_exporter -> 192.168.152.127 ... Done
- - Deploy node_exporter -> 192.168.152.130 ... Done
- - Deploy node_exporter -> 192.168.152.132 ... Done
- - Deploy node_exporter -> 192.168.152.133 ... Done
- - Deploy node_exporter -> 192.168.152.134 ... Done
- - Deploy node_exporter -> 192.168.152.128 ... Done
- - Deploy node_exporter -> 192.168.152.129 ... Done
- - Deploy node_exporter -> 192.168.152.131 ... Done
- - Deploy blackbox_exporter -> 192.168.152.130 ... Done
- - Deploy blackbox_exporter -> 192.168.152.132 ... Done
- - Deploy blackbox_exporter -> 192.168.152.133 ... Done
- - Deploy blackbox_exporter -> 192.168.152.134 ... Done
- - Deploy blackbox_exporter -> 192.168.152.128 ... Done
- - Deploy blackbox_exporter -> 192.168.152.129 ... Done
- - Deploy blackbox_exporter -> 192.168.152.131 ... Done
- - Deploy blackbox_exporter -> 192.168.152.126 ... Done
- - Deploy blackbox_exporter -> 192.168.152.127 ... Done
- + Copy certificate to remote host
- + Init instance configs
- - Generate config pd -> 192.168.152.126:2379 ... Done
- - Generate config pd -> 192.168.152.127:2379 ... Done
- + Init instance configs
- - Generate config pd -> 192.168.152.126:2379 ... Done
- - Generate config pd -> 192.168.152.127:2379 ... Done
- - Generate config pd -> 192.168.152.128:2379 ... Done
- - Generate config tikv -> 192.168.152.129:20160 ... Done
- - Generate config tikv -> 192.168.152.130:20160 ... Done
- - Generate config tikv -> 192.168.152.131:20160 ... Done
- - Generate config tidb -> 192.168.152.132:4000 ... Done
- - Generate config tidb -> 192.168.152.133:4000 ... Done
- - Generate config prometheus -> 192.168.152.134:9090 ... Done
- - Generate config grafana -> 192.168.152.134:3000 ... Done
- - Generate config alertmanager -> 192.168.152.134:9093 ... Done
- + Init monitor configs
- - Generate config node_exporter -> 192.168.152.126 ... Done
- - Generate config node_exporter -> 192.168.152.127 ... Done
- - Generate config node_exporter -> 192.168.152.130 ... Done
- - Generate config node_exporter -> 192.168.152.132 ... Done
- - Generate config node_exporter -> 192.168.152.133 ... Done
- - Generate config node_exporter -> 192.168.152.134 ... Done
- - Generate config node_exporter -> 192.168.152.128 ... Done
- - Generate config node_exporter -> 192.168.152.129 ... Done
- - Generate config node_exporter -> 192.168.152.131 ... Done
- - Generate config blackbox_exporter -> 192.168.152.127 ... Done
- - Generate config blackbox_exporter -> 192.168.152.130 ... Done
- - Generate config blackbox_exporter -> 192.168.152.132 ... Done
- - Generate config blackbox_exporter -> 192.168.152.133 ... Done
- - Generate config blackbox_exporter -> 192.168.152.134 ... Done
- - Generate config blackbox_exporter -> 192.168.152.128 ... Done
- - Generate config blackbox_exporter -> 192.168.152.129 ... Done
- - Generate config blackbox_exporter -> 192.168.152.131 ... Done
- - Generate config blackbox_exporter -> 192.168.152.126 ... Done
- Enabling component pd
- Enabling instance 192.168.152.128:2379
- Enabling instance 192.168.152.126:2379
- Enabling instance 192.168.152.127:2379
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable instance 192.168.152.128:2379 success
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable instance 192.168.152.127:2379 success
- download https://tiup-mirrors.pingcap.com/tidb-v8.5.6-linux-amd64.tar.gz 2.48 MiB / 97.69 MiB 2.54% ? MiB/s Enable instance 192.168.152.126:2379 success
- Enabling component tikv
- Enabling instance 192.168.152.131:20160
- Enabling instance 192.168.152.129:20160
- Enabling instance 192.168.152.130:20160
- download https://tiup-mirrors.pingcap.com/prometheus-v8.5.6-linux-amd64.tar.gz 528.00 KiB / 126.34 MiB 0.41% ? MiB/s Enable instance 192.168.152.130:20160 success
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable instance 192.168.152.131:20160 success
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable instance 192.168.152.129:20160 success
- Enabling component tidb
- Enabling instance 192.168.152.133:4000
- Enabling instance 192.168.152.132:4000
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable instance 192.168.152.133:4000 success
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable instance 192.168.152.132:4000 success
- Enabling component prometheus
- Enabling instance 192.168.152.134:9090
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable instance 192.168.152.134:9090 success
- Enabling component grafana
- Enabling instance 192.168.152.134:3000
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable instance 192.168.152.134:3000 success
- Enabling component alertmanager
- Enabling instance 192.168.152.134:9093
- download https://tiup-mirrors.pingcap.com/tidb-v8.5.6-linux-amd64.tar.gz 2.48 MiB / 97.69 MiB 2.54% ? MiB/s Enable instance 192.168.152.134:9093 success
- Enabling component node_exporter
- Enabling instance 192.168.152.134
- Enabling instance 192.168.152.126
- Enabling instance 192.168.152.127
- Enabling instance 192.168.152.128
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enabling instance 192.168.152.129
- Enabling instance 192.168.152.132
- Enabling instance 192.168.152.131
- Enabling instance 192.168.152.130
- Enabling instance 192.168.152.133
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable 192.168.152.131 success
- download https://tiup-mirrors.pingcap.com/tidb-v8.5.6-linux-amd64.tar.gz 2.48 MiB / 97.69 MiB 2.54% ? MiB/s Enable 192.168.152.130 success
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable 192.168.152.129 success
- Enable 192.168.152.133 success
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable 192.168.152.132 success
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable 192.168.152.126 success
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable 192.168.152.127 success
- download https://tiup-mirrors.pingcap.com/prometheus-v8.5.6-linux-amd64.tar.gz 528.00 KiB / 126.34 MiB 0.41% ? MiB/s Enable 192.168.152.128 success
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable 192.168.152.134 success
- Enabling component blackbox_exporter
- Enabling instance 192.168.152.134
- Enabling instance 192.168.152.126
- Enabling instance 192.168.152.127
- Enabling instance 192.168.152.128
- Enabling instance 192.168.152.130
- Enabling instance 192.168.152.131
- Enabling instance 192.168.152.133
- Enabling instance 192.168.152.132
- Enabling instance 192.168.152.129
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable 192.168.152.126 success
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable 192.168.152.130 success
- Enable 192.168.152.131 success
- download https://tiup-mirrors.pingcap.com/tikv-v8.5.6-linux-amd64.tar.gz 0 B / 376.95 MiB 0.00% ? MiB/s Enable 192.168.152.133 success
- download https://tiup-mirrors.pingcap.com/pd-v8.5.6-linux-amd64.tar.gz 0 B / 61.55 MiB 0.00% ? MiB/s Enable 192.168.152.127 success
- Enable 192.168.152.132 success
- Enable 192.168.152.129 success
- download https://tiup-mirrors.pingcap.com/prometheus-v8.5.6-linux-amd64.tar.gz 528.00 KiB / 126.34 MiB 0.41% ? MiB/s Enable 192.168.152.128 success
- download https://tiup-mirrors.pingcap.com/alertmanager-v0.26.0-linux-amd64.tar.gz 154.12 MiB / 28.34 MiB 543.85% ? MiB/s Enable 192.168.152.134 success
- Cluster `TiDBCluster` deployed successfully, you can start it with command: `tiup cluster start TiDBCluster --init`
- root@ubuntu24:~#
复制代码
6,启动集群
根据上述提示:you can start it with command: `tiup cluster start TiDBCluster --init`,笔者这里使用tiup cluster start TiDBCluster,没有加--init,也可以正常启动。
启动集群的本质就是:将集群中安装的TIDB组件注意启动起来- root@ubuntu24:~# tiup cluster start TiDBCluster
- Starting cluster TiDBCluster...
- + [ Serial ] - SSHKeySet: privateKey=/root/.tiup/storage/cluster/clusters/TiDBCluster/ssh/id_rsa, publicKey=/root/.tiup/storage/cluster/clusters/TiDBCluster/ssh/id_rsa.pub
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.130
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.131
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.132
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.133
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.126
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.127
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.128
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.129
- + [ Serial ] - StartCluster
- Starting component pd
- Starting instance 192.168.152.128:2379
- Starting instance 192.168.152.127:2379
- Starting instance 192.168.152.126:2379
- Start instance 192.168.152.128:2379 success
- Start instance 192.168.152.127:2379 success
- Start instance 192.168.152.126:2379 success
- Starting component tikv
- Starting instance 192.168.152.131:20160
- Starting instance 192.168.152.129:20160
- Starting instance 192.168.152.130:20160
- Start instance 192.168.152.131:20160 success
- Start instance 192.168.152.130:20160 success
- Start instance 192.168.152.129:20160 success
- Starting component tidb
- Starting instance 192.168.152.133:4000
- Starting instance 192.168.152.132:4000
- Start instance 192.168.152.133:4000 success
- Start instance 192.168.152.132:4000 success
- Starting component prometheus
- Starting instance 192.168.152.134:9090
- Start instance 192.168.152.134:9090 success
- Starting component grafana
- Starting instance 192.168.152.134:3000
- Start instance 192.168.152.134:3000 success
- Starting component alertmanager
- Starting instance 192.168.152.134:9093
- Start instance 192.168.152.134:9093 success
- Starting component node_exporter
- Starting instance 192.168.152.131
- Starting instance 192.168.152.133
- Starting instance 192.168.152.134
- Starting instance 192.168.152.126
- Starting instance 192.168.152.130
- Starting instance 192.168.152.132
- Starting instance 192.168.152.128
- Starting instance 192.168.152.127
- Starting instance 192.168.152.129
- Start 192.168.152.134 success
- Start 192.168.152.128 success
- Start 192.168.152.132 success
- Start 192.168.152.127 success
- Start 192.168.152.133 success
- Start 192.168.152.130 success
- Start 192.168.152.126 success
- Start 192.168.152.131 success
- Start 192.168.152.129 success
- Starting component blackbox_exporter
- Starting instance 192.168.152.131
- Starting instance 192.168.152.126
- Starting instance 192.168.152.130
- Starting instance 192.168.152.127
- Starting instance 192.168.152.132
- Starting instance 192.168.152.133
- Starting instance 192.168.152.134
- Starting instance 192.168.152.128
- Starting instance 192.168.152.129
- Start 192.168.152.126 success
- Start 192.168.152.127 success
- Start 192.168.152.131 success
- Start 192.168.152.134 success
- Start 192.168.152.130 success
- Start 192.168.152.128 success
- Start 192.168.152.129 success
- Start 192.168.152.132 success
- Start 192.168.152.133 success
- + [ Serial ] - UpdateTopology: cluster=TiDBCluster
- Started cluster `TiDBCluster` successfully
- root@ubuntu24:~#
复制代码
7,客户端毗连
TIDB兼容MySQL客户端协议,就把他当MySQL用好了,默认暗码为空:mysql -h 192.168.152.132 -P 4000 -u root,修改root暗码:ALTER USER 'root'@'%' IDENTIFIED BY 'root';- C:\Users\XX>mysql -h 192.168.152.132 -P 4000 -u root
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 3137339396
- Server version: 8.0.11-TiDB-v8.5.6 TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible
- Copyright (c) 2000, 2025, 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>
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | INFORMATION_SCHEMA |
- | METRICS_SCHEMA |
- | PERFORMANCE_SCHEMA |
- | mysql |
- | sys |
- | test |
- +--------------------+
- 6 rows in set (0.00 sec)
- mysql>
- mysql>
- mysql> select * from mysql.user \G
- *************************** 1. row ***************************
- Host: %
- User: root
- authentication_string:
- plugin: mysql_native_password
- Select_priv: Y
- Insert_priv: Y
- Update_priv: Y
- Delete_priv: Y
- Create_priv: Y
- Drop_priv: Y
- Process_priv: Y
- Grant_priv: Y
- References_priv: Y
- Alter_priv: Y
- Show_db_priv: Y
- Super_priv: Y
- Create_tmp_table_priv: Y
- Lock_tables_priv: Y
- Execute_priv: Y
- Create_view_priv: Y
- Show_view_priv: Y
- Create_routine_priv: Y
- Alter_routine_priv: Y
- Index_priv: Y
- Create_user_priv: Y
- Event_priv: Y
- Repl_slave_priv: Y
- Repl_client_priv: Y
- Trigger_priv: Y
- Create_role_priv: Y
- Drop_role_priv: Y
- Account_locked: N
- Shutdown_priv: Y
- Reload_priv: Y
- FILE_priv: Y
- Config_priv: Y
- Create_Tablespace_Priv: Y
- Password_reuse_history: NULL
- Password_reuse_time: NULL
- User_attributes: NULL
- Token_issuer:
- Password_expired: N
- Password_last_changed: 2026-05-06 07:43:53
- Password_lifetime: NULL
- 1 row in set (0.00 sec)
- mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'root';
- Query OK, 0 rows affected (0.11 sec)
- mysql> flush privileges;
- Query OK, 0 rows affected (0.02 sec)
- mysql>
复制代码
8,集群检察
实验以下下令确认当前已经摆设的集群列表:tiup cluster list- root@ubuntu15:~# tiup cluster list
- Name User Version Path PrivateKey
- ---- ---- ------- ---- ----------
- TiDBCluster tidb v8.5.6 /root/.tiup/storage/cluster/clusters/TiDBCluster /root/.tiup/storage/cluster/clusters/TiDBCluster/ssh/id_rsa
- root@ubuntu15:~#
复制代码 实验以下下令检察集群的拓扑布局和状态:tiup cluster display TiDBCluster- root@ubuntu15:~# tiup cluster display TiDBCluster
- Cluster type: tidb
- Cluster name: TiDBCluster
- Cluster version: v8.5.6
- Deploy user: tidb
- SSH type: builtin
- Dashboard URL: http://192.168.152.125:2379/dashboard
- Dashboard URLs: http://192.168.152.125:2379/dashboard
- Grafana URL: http://192.168.152.125:3000
- ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
- -- ---- ---- ----- ------- ------ -------- ----------
- 192.168.152.125:3000 grafana 192.168.152.125 3000 linux/x86_64 Up - /tidb-deploy/grafana-3000
- 192.168.152.125:2379 pd 192.168.152.125 2379/2380 linux/x86_64 Up|L|UI /tidb-data/pd-2379 /tidb-deploy/pd-2379
- 192.168.152.125:9090 prometheus 192.168.152.125 9090/9115/9100/12020 linux/x86_64 Up /tidb-data/prometheus-9090 /tidb-deploy/prometheus-9090
- 192.168.152.125:4000 tidb 192.168.152.125 4000/10080 linux/x86_64 Up - /tidb-deploy/tidb-4000
- 192.168.152.125:9000 tiflash 192.168.152.125 9000/3930/20170/20292/8234/8123 linux/x86_64 Up /tidb-data/tiflash-9000 /tidb-deploy/tiflash-9000
- 192.168.152.125:20160 tikv 192.168.152.125 20160/20180 linux/x86_64 Up /tidb-data/tikv-20160 /tidb-deploy/tikv-20160
- 192.168.152.125:20161 tikv 192.168.152.125 20161/20181 linux/x86_64 Up /tidb-data/tikv-20161 /tidb-deploy/tikv-20161
- 192.168.152.125:20162 tikv 192.168.152.125 20162/20182 linux/x86_64 Up /tidb-data/tikv-20162 /tidb-deploy/tikv-20162
- Total nodes: 8
- root@ubuntu15:~#
复制代码
9,集群监控 配景
注意上面的输出- Dashboard URL: http://192.168.152.125:2379/dashboard
- Dashboard URLs: http://192.168.152.125:2379/dashboard
- Grafana URL: http://192.168.152.125:3000
复制代码 Monitor Server:访问 Grafana 监控 页面:http://192.168.152.134:3000,默认用户名和暗码均为 admin。PD Server:访问集群 TiDB Dashboard 监控 页面:http://192.168.152.126:2379/dashboard,默认用户名为 root,暗码为空。
对于Monitor Server的prometheus和 Grafana监控,已经预定了多个garfana的dashboard,以及altermanager告警规则,这里随意截几个图,不逐一截图,非常本心,从安装到监控,再到告警,可谓是一站式服务(白嫖)。
访问集群 TiDB Dashboard 监控页面,是对于PD监控的控制台页面
10,设置systemctl服务
以上通过下令启动了TIDB集群中各个节点上的组件,如果要设置为systemctl主动启动,必要实验,tiup cluster enable TiDBCluster- root@ubuntu24:~# tiup cluster enable TiDBCluster
- Enabling cluster TiDBCluster...
- + [ Serial ] - SSHKeySet: privateKey=/root/.tiup/storage/cluster/clusters/TiDBCluster/ssh/id_rsa, publicKey=/root/.tiup/storage/cluster/clusters/TiDBCluster/ssh/id_rsa.pub
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.130
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.131
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.132
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.127
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.133
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.134
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.126
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.129
- + [Parallel] - UserSSH: user=tidb, host=192.168.152.128
- + [ Serial ] - EnableCluster
- Enabling component pd
- Enabling instance 192.168.152.128:2379
- Enabling instance 192.168.152.126:2379
- Enabling instance 192.168.152.127:2379
- Enable instance 192.168.152.127:2379 success
- Enable instance 192.168.152.128:2379 success
- Enable instance 192.168.152.126:2379 success
- Enabling component tikv
- Enabling instance 192.168.152.131:20160
- Enabling instance 192.168.152.129:20160
- Enabling instance 192.168.152.130:20160
- Enable instance 192.168.152.129:20160 success
- Enable instance 192.168.152.130:20160 success
- Enable instance 192.168.152.131:20160 success
- Enabling component tidb
- Enabling instance 192.168.152.133:4000
- Enabling instance 192.168.152.132:4000
- Enable instance 192.168.152.132:4000 success
- Enable instance 192.168.152.133:4000 success
- Enabling component prometheus
- Enabling instance 192.168.152.134:9090
- Enable instance 192.168.152.134:9090 success
- Enabling component grafana
- Enabling instance 192.168.152.134:3000
- Enable instance 192.168.152.134:3000 success
- Enabling component alertmanager
- Enabling instance 192.168.152.134:9093
- Enable instance 192.168.152.134:9093 success
- Enabling component node_exporter
- Enabling instance 192.168.152.129
- Enabling instance 192.168.152.131
- Enabling instance 192.168.152.133
- Enabling instance 192.168.152.134
- Enabling instance 192.168.152.126
- Enabling instance 192.168.152.127
- Enabling instance 192.168.152.132
- Enabling instance 192.168.152.128
- Enabling instance 192.168.152.130
- Enable 192.168.152.126 success
- Enable 192.168.152.131 success
- Enable 192.168.152.128 success
- Enable 192.168.152.134 success
- Enable 192.168.152.127 success
- Enable 192.168.152.129 success
- Enable 192.168.152.130 success
- Enable 192.168.152.133 success
- Enable 192.168.152.132 success
- Enabling component blackbox_exporter
- Enabling instance 192.168.152.129
- Enabling instance 192.168.152.131
- Enabling instance 192.168.152.133
- Enabling instance 192.168.152.134
- Enabling instance 192.168.152.126
- Enabling instance 192.168.152.127
- Enabling instance 192.168.152.132
- Enabling instance 192.168.152.128
- Enabling instance 192.168.152.130
- Enable 192.168.152.126 success
- Enable 192.168.152.128 success
- Enable 192.168.152.134 success
- Enable 192.168.152.127 success
- Enable 192.168.152.130 success
- Enable 192.168.152.133 success
- Enable 192.168.152.129 success
- Enable 192.168.152.132 success
- Enable 192.168.152.131 success
- Enabled cluster `TiDBCluster` successfully
- root@ubuntu24:~#
复制代码 1,PD Server
PD Server上天生三个systemctl服务:pd-2379,blackbox_exporter-9115.service, node_exporter-9100- root@ubuntu16:/etc/systemd/system# ll -t
- total 168
- drwxr-xr-x 2 root root 4096 May 6 07:40 multi-user.target.wants/
- drwxr-xr-x 21 root root 4096 May 6 07:40 ./
- -rw-r--r-- 1 tidb tidb 361 May 6 07:40 blackbox_exporter-9115.service
- -rw-r--r-- 1 tidb tidb 321 May 6 07:40 node_exporter-9100.service
- -rw-r--r-- 1 tidb tidb 294 May 6 07:40 pd-2379.service
- root@ubuntu16:/etc/systemd/system# systemctl status pd-2379
- ● pd-2379.service - pd service
- Loaded: loaded (/etc/systemd/system/pd-2379.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:43:36 UTC; 4h 33min ago
- Main PID: 19125 (pd-server)
- Tasks: 9 (limit: 4550)
- Memory: 74.1M
- CGroup: /system.slice/pd-2379.service
- └─19125 bin/pd-server --name=pd-192.168.152.126-2379 --client-urls=http://0.0.0.0:2379 --advertise-client-urls=http://192.168.152.126:2379 --peer-urls=http://0.0.0.0:2380 --advert>
- May 06 07:43:36 ubuntu16 systemd[1]: Started pd service.
- root@ubuntu16:/etc/systemd/system# systemctl status blackbox_exporter-9115.service
- ● blackbox_exporter-9115.service - blackbox_exporter service
- Loaded: loaded (/etc/systemd/system/blackbox_exporter-9115.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:06 UTC; 4h 33min ago
- Main PID: 19629 (blackbox_export)
- Tasks: 11 (limit: 4550)
- Memory: 11.0M
- CGroup: /system.slice/blackbox_exporter-9115.service
- ├─19629 bin/blackbox_exporter/blackbox_exporter --web.listen-address=:9115 --log.level=info --config.file=conf/blackbox.yml
- ├─19633 /bin/bash /tidb-deploy/monitor-9100/scripts/run_blackbox_exporter.sh
- └─19634 tee -i -a /tidb-deploy/monitor-9100/log/blackbox_exporter.log
- May 06 07:44:06 ubuntu16 systemd[1]: Started blackbox_exporter service.
- May 06 07:44:06 ubuntu16 bash[19634]: ts=2026-05-06T07:44:06.951Z caller=main.go:78 level=info msg="Starting blackbox_exporter" version="(version=0.23.0, branch=HEAD, revision=26fc98b9c6db2145>
- May 06 07:44:06 ubuntu16 bash[19634]: ts=2026-05-06T07:44:06.956Z caller=main.go:79 level=info build_context="(go=go1.19.3, user=root@f360719453e3, date=20221202-12:26:32)"
- May 06 07:44:06 ubuntu16 bash[19634]: ts=2026-05-06T07:44:06.957Z caller=main.go:91 level=info msg="Loaded config file"
- May 06 07:44:06 ubuntu16 bash[19634]: ts=2026-05-06T07:44:06.962Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9115
- May 06 07:44:06 ubuntu16 bash[19634]: ts=2026-05-06T07:44:06.962Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9115
- root@ubuntu16:/etc/systemd/system# systemctl status node_exporter-9100
- ● node_exporter-9100.service - node_exporter service
- Loaded: loaded (/etc/systemd/system/node_exporter-9100.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:04 UTC; 4h 33min ago
- Main PID: 19393 (node_exporter)
- Tasks: 7 (limit: 4550)
- Memory: 10.3M
- CGroup: /system.slice/node_exporter-9100.service
- ├─19393 bin/node_exporter/node_exporter --web.listen-address=:9100 --collector.tcpstat --collector.mountstats --collector.meminfo_numa --collector.buddyinfo --collector.vmstat.fie>
- ├─19396 /bin/bash /tidb-deploy/monitor-9100/scripts/run_node_exporter.sh
- └─19397 tee -i -a /tidb-deploy/monitor-9100/log/node_exporter.log
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.673Z caller=node_exporter.go:117 level=info collector=thermal_zone
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.673Z caller=node_exporter.go:117 level=info collector=time
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=timex
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=udp_queues
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=uname
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=vmstat
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=xfs
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.674Z caller=node_exporter.go:117 level=info collector=zfs
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.677Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9100
- May 06 07:44:04 ubuntu16 bash[19397]: ts=2026-05-06T07:44:04.677Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9100
复制代码
2,TiDB Server
TiDB Server上天生三个systemctl服务:tidb-4000,blackbox_exporter-9115.service, node_exporter-9100- root@ubuntu22:/etc/systemd/system# ll -t
- total 168
- drwxr-xr-x 2 root root 4096 May 6 07:41 multi-user.target.wants/
- drwxr-xr-x 21 root root 4096 May 6 07:40 ./
- -rw-r--r-- 1 tidb tidb 361 May 6 07:40 blackbox_exporter-9115.service
- -rw-r--r-- 1 tidb tidb 321 May 6 07:40 node_exporter-9100.service
- -rw-r--r-- 1 tidb tidb 300 May 6 07:40 tidb-4000.service
- root@ubuntu22:/etc/systemd/system# systemctl status tidb-4000
- ● tidb-4000.service - tidb service
- Loaded: loaded (/etc/systemd/system/tidb-4000.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:43:43 UTC; 4h 35min ago
- Main PID: 17235 (tidb-server)
- Tasks: 9 (limit: 4550)
- Memory: 327.3M
- CGroup: /system.slice/tidb-4000.service
- └─17235 bin/tidb-server -P 4000 --status=10080 --host=0.0.0.0 --advertise-address=192.168.152.132 --store=tikv --initialize-insecure --path=192.168.152.126:2379,192.168.152.127:23>
- May 06 07:43:43 ubuntu22 systemd[1]: Started tidb service.
- root@ubuntu22:/etc/systemd/system# systemctl status blackbox_exporter-9115
- ● blackbox_exporter-9115.service - blackbox_exporter service
- Loaded: loaded (/etc/systemd/system/blackbox_exporter-9115.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:07 UTC; 4h 35min ago
- Main PID: 18215 (blackbox_export)
- Tasks: 11 (limit: 4550)
- Memory: 10.8M
- CGroup: /system.slice/blackbox_exporter-9115.service
- ├─18215 bin/blackbox_exporter/blackbox_exporter --web.listen-address=:9115 --log.level=info --config.file=conf/blackbox.yml
- ├─18217 /bin/bash /tidb-deploy/monitor-9100/scripts/run_blackbox_exporter.sh
- └─18221 tee -i -a /tidb-deploy/monitor-9100/log/blackbox_exporter.log
- May 06 07:44:07 ubuntu22 systemd[1]: Started blackbox_exporter service.
- May 06 07:44:07 ubuntu22 bash[18221]: ts=2026-05-06T07:44:07.130Z caller=main.go:78 level=info msg="Starting blackbox_exporter" version="(version=0.23.0, branch=HEAD, revision=26fc98b9c6db2145>
- May 06 07:44:07 ubuntu22 bash[18221]: ts=2026-05-06T07:44:07.130Z caller=main.go:79 level=info build_context="(go=go1.19.3, user=root@f360719453e3, date=20221202-12:26:32)"
- May 06 07:44:07 ubuntu22 bash[18221]: ts=2026-05-06T07:44:07.131Z caller=main.go:91 level=info msg="Loaded config file"
- May 06 07:44:07 ubuntu22 bash[18221]: ts=2026-05-06T07:44:07.133Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9115
- May 06 07:44:07 ubuntu22 bash[18221]: ts=2026-05-06T07:44:07.133Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9115
- root@ubuntu22:/etc/systemd/system# systemctl status node_exporter-9100
- ● node_exporter-9100.service - node_exporter service
- Loaded: loaded (/etc/systemd/system/node_exporter-9100.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:04 UTC; 4h 35min ago
- Main PID: 18001 (node_exporter)
- Tasks: 6 (limit: 4550)
- Memory: 9.9M
- CGroup: /system.slice/node_exporter-9100.service
- ├─18001 bin/node_exporter/node_exporter --web.listen-address=:9100 --collector.tcpstat --collector.mountstats --collector.meminfo_numa --collector.buddyinfo --collector.vmstat.fie>
- ├─18003 /bin/bash /tidb-deploy/monitor-9100/scripts/run_node_exporter.sh
- └─18004 tee -i -a /tidb-deploy/monitor-9100/log/node_exporter.log
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=thermal_zone
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=time
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=timex
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=udp_queues
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=uname
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=vmstat
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=xfs
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.330Z caller=node_exporter.go:117 level=info collector=zfs
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.332Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9100
- May 06 07:44:04 ubuntu22 bash[18004]: ts=2026-05-06T07:44:04.332Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9100
- root@ubuntu22:/etc/systemd/system#
复制代码
3,TiKV Server
TiKV Server上天生三个systemctl服务:tikv-20160,blackbox_exporter-9115.service, node_exporter-9100- root@ubuntu19:/etc/systemd/system# ll -t
- total 168
- drwxr-xr-x 2 root root 4096 May 6 07:41 multi-user.target.wants/
- drwxr-xr-x 21 root root 4096 May 6 07:40 ./
- -rw-r--r-- 1 tidb tidb 361 May 6 07:40 blackbox_exporter-9115.service
- -rw-r--r-- 1 tidb tidb 321 May 6 07:40 node_exporter-9100.service
- -rw-r--r-- 1 tidb tidb 301 May 6 07:40 tikv-20160.service
- root@ubuntu19:/etc/systemd/system# systemctl status tikv-20160
- ● tikv-20160.service - tikv service
- Loaded: loaded (/etc/systemd/system/tikv-20160.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:43:38 UTC; 4h 37min ago
- Main PID: 17217 (tikv-server)
- Tasks: 135 (limit: 4550)
- Memory: 1.9G
- CGroup: /system.slice/tikv-20160.service
- └─17217 bin/tikv-server --addr 0.0.0.0:20160 --advertise-addr 192.168.152.129:20160 --status-addr 0.0.0.0:20180 --advertise-status-addr 192.168.152.129:20180 --pd 192.168.152.126:>
- May 06 07:43:38 ubuntu19 systemd[1]: Started tikv service.
- May 06 07:43:39 ubuntu19 bash[17217]: sync ...
- May 06 07:43:39 ubuntu19 bash[17219]: real 0m0.027s
- May 06 07:43:39 ubuntu19 bash[17219]: user 0m0.004s
- May 06 07:43:39 ubuntu19 bash[17219]: sys 0m0.000s
- May 06 07:43:39 ubuntu19 bash[17217]: ok
- root@ubuntu19:/etc/systemd/system# systemctl status node_exporter-9100
- ● node_exporter-9100.service - node_exporter service
- Loaded: loaded (/etc/systemd/system/node_exporter-9100.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:05 UTC; 4h 37min ago
- Main PID: 17684 (node_exporter)
- Tasks: 8 (limit: 4550)
- Memory: 9.7M
- CGroup: /system.slice/node_exporter-9100.service
- ├─17684 bin/node_exporter/node_exporter --web.listen-address=:9100 --collector.tcpstat --collector.mountstats --collector.meminfo_numa --collector.buddyinfo --collector.vmstat.fie>
- ├─17686 /bin/bash /tidb-deploy/monitor-9100/scripts/run_node_exporter.sh
- └─17688 tee -i -a /tidb-deploy/monitor-9100/log/node_exporter.log
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=thermal_zone
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=time
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=timex
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=udp_queues
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=uname
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=vmstat
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=xfs
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.087Z caller=node_exporter.go:117 level=info collector=zfs
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.092Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9100
- May 06 07:44:05 ubuntu19 bash[17688]: ts=2026-05-06T07:44:05.092Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9100
- root@ubuntu19:/etc/systemd/system# systemctl status blackbox_exporter-9115
- ● blackbox_exporter-9115.service - blackbox_exporter service
- Loaded: loaded (/etc/systemd/system/blackbox_exporter-9115.service; enabled; vendor preset: enabled)
- Active: active (running) since Wed 2026-05-06 07:44:07 UTC; 4h 37min ago
- Main PID: 17879 (blackbox_export)
- Tasks: 11 (limit: 4550)
- Memory: 10.4M
- CGroup: /system.slice/blackbox_exporter-9115.service
- ├─17879 bin/blackbox_exporter/blackbox_exporter --web.listen-address=:9115 --log.level=info --config.file=conf/blackbox.yml
- ├─17881 /bin/bash /tidb-deploy/monitor-9100/scripts/run_blackbox_exporter.sh
- └─17882 tee -i -a /tidb-deploy/monitor-9100/log/blackbox_exporter.log
- May 06 07:44:07 ubuntu19 systemd[1]: Started blackbox_exporter service.
- May 06 07:44:07 ubuntu19 bash[17882]: ts=2026-05-06T07:44:07.071Z caller=main.go:78 level=info msg="Starting blackbox_exporter" version="(version=0.23.0, branch=HEAD, revision=26fc98b9c6db2145>
- May 06 07:44:07 ubuntu19 bash[17882]: ts=2026-05-06T07:44:07.074Z caller=main.go:79 level=info build_context="(go=go1.19.3, user=root@f360719453e3, date=20221202-12:26:32)"
- May 06 07:44:07 ubuntu19 bash[17882]: ts=2026-05-06T07:44:07.074Z caller=main.go:91 level=info msg="Loaded config file"
- May 06 07:44:07 ubuntu19 bash[17882]: ts=2026-05-06T07:44:07.075Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9115
- May 06 07:44:07 ubuntu19 bash[17882]: ts=2026-05-06T07:44:07.075Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9115
- root@ubuntu19:/etc/systemd/system#
复制代码
4,Monitor Server
Monitor Server上天生了:grafana-3000, prometheus-9090,alertmanager-9093,node_exporter-9100, blackbox_exporter-9115等5个systemctl服务- root@ubuntu24:/etc/systemd/system# ll -t
- total 176
- drwxr-xr-x 2 root root 4096 May 6 07:41 multi-user.target.wants/
- drwxr-xr-x 21 root root 4096 May 6 07:40 ./
- -rw-r--r-- 1 tidb tidb 361 May 6 07:40 blackbox_exporter-9115.service
- -rw-r--r-- 1 tidb tidb 321 May 6 07:40 node_exporter-9100.service
- -rw-r--r-- 1 tidb tidb 324 May 6 07:40 alertmanager-9093.service
- -rw-r--r-- 1 tidb tidb 427 May 6 07:40 prometheus-9090.service
- -rw-r--r-- 1 tidb tidb 309 May 6 07:40 grafana-3000.service
复制代码
以上可以快速创建一个“最小拓扑架构”的TIDB集群,由于其客户端兼容MySQL协议,客户端访问页非常方便,可以快速上手TIDB的集群。
免责声明:如果侵犯了您的权益,请联系站长及时删除侵权内容,谢谢合作!qidao123.com:ToB企服之家,中国第一个企服评测及软件市场,开放入驻,技术点评得现金. |