惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
量子位
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
博客园 - 聂微东
美团技术团队
Last Week in AI
Last Week in AI
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog

博客园 - MSSQL123

timescaledb 扩展 PostgreSQL 18+ 版本下源码编译安装 ubuntu24下 ext4和xfs类型磁盘以及PostgreSQL实例性能对比测试 PostgreSQL 18 新特性 skip scan,一个鸡肋的功能 PostgreSQL 17 流复制中开启逻辑复制槽同步,以及逻辑槽的故障转移 记一次PostgreSQL交叉表crosstab行转列导致的OOM PostgreSQL 高可用集群 patroni 自动故障转移测试 Ubuntu 20 环境下 patroni 自动化安装,一分钟快速搭建 patroni 集群 Ubuntu 20 环境下 pg_auto_failover 自动化安装,一分钟快速搭建pg_auto_failover集群 PostgreSQL的消息队列扩展pgmq 磁盘IO延迟和队列深度的关系 TiDB 最小拓扑架构集群安装 PostgreSQL 逻辑复制中的同步和异步模式以及其表现 prometheus 的 altermanager Silences静默告警,优雅地抑制告警 “世界上百分之99的博士和他们的论文都是垃圾”,原本以为这个观点偏激 pg_auto_failover 在多种场景下自动故障转移的验证 pgbouncer连接池设置与压力测试的最大连接数测试 pg_auto_failover 自动故障转移参数 博文阅读密码验证 - 博客园 pg_auto_failover 高可用中,PostgreSQL实例配置文件的加载步骤 pg_auto_failover集群monitor节点的高可用 prometheus监控Linux Server node_exporter代理安装和配置 prometheus监控windows window_exporter代理安装和配置 Prometheus 和 Grafana 监控 PostgreSQL 记一次MySQL binlog日志导致磁盘空间占满的问题 SQLServer 2019 标准版在虚拟机上无法充分利用CPU的问题诊断 Windows Failover Cluster集群中的EventId 1196错误日志 pg_auto_failover 环境变量导致的show命令错误 SqlServer 事务复制(transaction replication)的复制位点信息 SqlServer 事务复制的两个参数immediate_sync,allow_anonymous MySQL,SqlServer,PostgreSQL中,如何实现锁定一张表
TiDB 扩容与缩容
MSSQL123 · 2026-05-26 · via 博客园 - MSSQL123

2,扩容检查

命令:tiup cluster check TiDBCluster /TiDB/pd_server_scale_out.yaml --cluster

root@ubuntu24:/TiDB# tiup cluster check TiDBCluster /TiDB/pd_server_scale_out.yaml --cluster

+ Detect CPU Arch Name
  - Detecting node 192.168.152.135 Arch info ... Done

+ Detect CPU OS Name
  - Detecting node 192.168.152.135 OS info ... Done
+ Download necessary tools
  - Downloading check tools for linux/amd64 ... Done
+ Collect basic system information
+ Collect basic system information
+ Collect basic system information
  - Getting system info of 192.168.152.135:22 ... Done
  - Getting system info of 192.168.152.126:22 ... Done
+ Check time zone
  - Checking node 192.168.152.135 ... Done

+ Check system requirements
+ Check system requirements
+ Check system requirements
  - Checking node 192.168.152.135 ... Done
  - Checking node 192.168.152.135 ... Done
+ Cleanup check files
  - Cleanup check files on 192.168.152.135:22 ... Done
  - Cleanup check files on 192.168.152.126:22 ... Done
Node             Check           Result  Message
----             -----           ------  -------
192.168.152.135  selinux_status  Fail    executor.ssh.execute_failed: Failed to execute command over SSH for 'root@192.168.152.135:22' {ssh_stderr: bash: getenforce: command not found
                                         , ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin; /usr/bin/sudo -H bash -c "getenforce"}, cause: Process exited with status 127 bash: getenforce: command not found

192.168.152.135  memory          Pass    memory size is 2048MB
192.168.152.135  disk            Warn    mount point / does not have 'noatime' option set
192.168.152.135  thp             Fail    THP is enabled, please disable it for best performance
192.168.152.135  service         Pass    service firewalld not found, ignore
192.168.152.135  command         Fail    numactl not usable, bash: numactl: command not found
192.168.152.135  timezone        Pass    time zone is the same as the first PD machine: Etc/UTC
192.168.152.135  os-version      Warn    OS is Ubuntu 20.04 LTS 20.04 (Ubuntu support is not fully tested, be careful)
192.168.152.135  cpu-cores       Pass    number of CPU cores / threads: 2
192.168.152.135  cpu-governor    Warn    unable to determine current CPU frequency governor policy
192.168.152.135  network         Pass    network speed of ens33 is 1000MB
192.168.152.135  disk            Fail    mount point / does not have 'nodelalloc' option set
192.168.152.135  selinux_conf    Pass    SELinux is disabled in configuration
root@ubuntu24:/TiDB#
root@ubuntu24:/TiDB#

3,扩容检查修改

命令:tiup cluster check TiDBCluster /TiDB/pd_server_scale_out.yaml --cluster --apply

root@ubuntu24:/TiDB# tiup cluster check TiDBCluster /TiDB/pd_server_scale_out.yaml --cluster --apply

+ Detect CPU Arch Name
  - Detecting node 192.168.152.135 Arch info ... Done

+ Detect CPU OS Name
  - Detecting node 192.168.152.135 OS info ... Done
+ Download necessary tools
  - Downloading check tools for linux/amd64 ... Done
+ Collect basic system information
  - Getting system info of 192.168.152.135:22 ... ⠇ CopyComponent: component=insight, version=, remote=192.168.152.135:/tmp/tiup os=linux, arch=amd64
+ Collect basic system information
  - Getting system info of 192.168.152.135:22 ... Done
  - Getting system info of 192.168.152.126:22 ... Done
+ Check time zone
  - Checking node 192.168.152.135 ... Done

+ Check system requirements
+ Check system requirements
+ Check system requirements
  - Checking node 192.168.152.135 ... Done
  - Checking node 192.168.152.135 ... Done
+ Cleanup check files
  - Cleanup check files on 192.168.152.135:22 ... Done
  - Cleanup check files on 192.168.152.126:22 ... Done
Node             Check           Result  Message
----             -----           ------  -------
192.168.152.135  selinux_status  Fail    will try to disable SELinux, reboot might be needed
192.168.152.135  command         Fail    numactl not usable, bash: numactl: command not found, auto fixing not supported
192.168.152.135  os-version      Warn    OS is Ubuntu 20.04 LTS 20.04 (Ubuntu support is not fully tested, be careful), auto fixing not supported
192.168.152.135  disk            Fail    mount point / does not have 'nodelalloc' option set, auto fixing not supported
192.168.152.135  disk            Warn    mount point / does not have 'noatime' option set, auto fixing not supported
192.168.152.135  thp             Fail    will try to disable THP, please check again after reboot
192.168.152.135  service         Pass    service firewalld not found, ignore
192.168.152.135  timezone        Pass    time zone is the same as the first PD machine: Etc/UTC
192.168.152.135  cpu-cores       Pass    number of CPU cores / threads: 2
192.168.152.135  cpu-governor    Warn    unable to determine current CPU frequency governor policy, auto fixing not supported
192.168.152.135  memory          Pass    memory size is 2048MB
192.168.152.135  network         Pass    network speed of ens33 is 1000MB
192.168.152.135  selinux_conf    Pass    SELinux is disabled in configuration

+ Try to apply changes to fix failed checks
  - Applying changes on 192.168.152.135 ... Error

Error: executor.ssh.execute_failed: Failed to execute command over SSH for 'root@192.168.152.135:22' {ssh_stderr: sed: can't read /etc/selinux/config: No such file or directory
, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin; /usr/bin/sudo -H bash -c "sed -i 's/^[[:blank:]]*SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && setenforce 0"}, cause: Process exited with status 2

Verbose debug logs has been written to /root/.tiup/logs/tiup-cluster-debug-2026-05-26-06-27-36.log.
root@ubuntu24:/TiDB#

4,执行扩容

扩容命令:tiup cluster scale-out TiDBCluster /TiDB/pd_server_scale_out.yaml
可以发现扩容成功并成功加入集群

root@ubuntu24:/TiDB# tiup cluster scale-out TiDBCluster /TiDB/pd_server_scale_out.yaml

+ Detect CPU Arch Name
  - Detecting node 192.168.152.135 Arch info ... Done

+ Detect CPU OS Name
  - Detecting node 192.168.152.135 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.135  2379/2380  linux/x86_64  /tidb-deploy/pd-2379,/tidb-data/pd-2379
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
+ [ 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.126
+ [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.128
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.129
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.127
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.135
+ Download TiDB components
  - Download pd:v8.5.6 (linux/amd64) ... Done
+ Initialize target host environments
+ Deploy TiDB instance
  - Deploy instance pd -> 192.168.152.135:2379 ... Done
+ Copy certificate to remote host
+ Generate scale-out config
  - Generate scale-out config pd -> 192.168.152.135:2379 ... Done
+ Init monitor config
Enabling component pd
        Enabling instance 192.168.152.135:2379
        Enable instance 192.168.152.135:2379 success
Enabling component node_exporter
        Enabling instance 192.168.152.135
        Enable 192.168.152.135 success
Enabling component blackbox_exporter
        Enabling instance 192.168.152.135
        Enable 192.168.152.135 success
+ [ Serial ] - Save meta
+ [ Serial ] - Start new instances
Starting component pd
        Starting instance 192.168.152.135:2379
        Start instance 192.168.152.135:2379 success
Starting component node_exporter
        Starting instance 192.168.152.135
        Start 192.168.152.135 success
Starting component blackbox_exporter
        Starting instance 192.168.152.135
        Start 192.168.152.135 success
+ Refresh components conifgs
  - Generate config pd -> 192.168.152.126:2379 ... Done
+ Refresh components conifgs
  - 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 pd -> 192.168.152.135: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 tikv -> 192.168.152.135: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
+ Reload prometheus and grafana
  - Reload prometheus -> 192.168.152.134:9090 ... Done
  - Reload grafana -> 192.168.152.134:3000 ... Done
+ [ Serial ] - UpdateTopology: cluster=TiDBCluster
Scaled cluster `TiDBCluster` out successfully
root@ubuntu24:/TiDB#
root@ubuntu24:/TiDB#
root@ubuntu24:/TiDB#
root@ubuntu24:/TiDB# 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.127:2379/dashboard
Dashboard URLs:     http://192.168.152.127:2379/dashboard
Grafana URL:        http://192.168.152.134:3000
ID                     Role          Host             Ports                 OS/Arch       Status     Data Dir                      Deploy Dir
--                     ----          ----             -----                 -------       ------     --------                      ----------
192.168.152.134:9093   alertmanager  192.168.152.134  9093/9094             linux/x86_64  Up         /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
192.168.152.134:3000   grafana       192.168.152.134  3000                  linux/x86_64  Up         -                             /tidb-deploy/grafana-3000
192.168.152.126:2379   pd            192.168.152.126  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.127:2379   pd            192.168.152.127  2379/2380             linux/x86_64  Up|L|UI    /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.128:2379   pd            192.168.152.128  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.135:2379   pd            192.168.152.135  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.134:9090   prometheus    192.168.152.134  9090/9115/9100/12020  linux/x86_64  Up         /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
192.168.152.132:4000   tidb          192.168.152.132  4000/10080            linux/x86_64  Up         -                             /tidb-deploy/tidb-4000
192.168.152.133:4000   tidb          192.168.152.133  4000/10080            linux/x86_64  Up         -                             /tidb-deploy/tidb-4000
192.168.152.129:20160  tikv          192.168.152.129  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.130:20160  tikv          192.168.152.130  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.131:20160  tikv          192.168.152.131  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.135:20160  tikv          192.168.152.135  20160/20180           linux/x86_64  Tombstone  /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
Total nodes: 13
Total nodes: 13
There are some nodes can be pruned:
        Nodes: [192.168.152.135:20160]
        You can destroy them with the command: `tiup cluster prune TiDBCluster`
root@ubuntu24:/TiDB#

这里发现192.168.152.135  20160/20180           linux/x86_64  处于Tombstone,因为之前对TiKV缩容,这个节点下线之后并没有彻底清理,,根据系统的提示tiup cluster prune TiDBCluster,清理集群中所有状态为 Tombstone 的实例。


root@ubuntu24:/TiDB# 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.127:2379/dashboard
Dashboard URLs:     http://192.168.152.127:2379/dashboard
Grafana URL:        http://192.168.152.134:3000
ID                     Role          Host             Ports                 OS/Arch       Status     Data Dir                      Deploy Dir
--                     ----          ----             -----                 -------       ------     --------                      ----------
192.168.152.134:9093   alertmanager  192.168.152.134  9093/9094             linux/x86_64  Up         /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
192.168.152.134:3000   grafana       192.168.152.134  3000                  linux/x86_64  Up         -                             /tidb-deploy/grafana-3000
192.168.152.126:2379   pd            192.168.152.126  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.127:2379   pd            192.168.152.127  2379/2380             linux/x86_64  Up|L|UI    /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.128:2379   pd            192.168.152.128  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.135:2379   pd            192.168.152.135  2379/2380             linux/x86_64  Up         /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.134:9090   prometheus    192.168.152.134  9090/9115/9100/12020  linux/x86_64  Up         /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
192.168.152.132:4000   tidb          192.168.152.132  4000/10080            linux/x86_64  Up         -                             /tidb-deploy/tidb-4000
192.168.152.133:4000   tidb          192.168.152.133  4000/10080            linux/x86_64  Up         -                             /tidb-deploy/tidb-4000
192.168.152.129:20160  tikv          192.168.152.129  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.130:20160  tikv          192.168.152.130  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.131:20160  tikv          192.168.152.131  20160/20180           linux/x86_64  Up         /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.135:20160  tikv          192.168.152.135  20160/20180           linux/x86_64  Tombstone  /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
Total nodes: 13
There are some nodes can be pruned:
        Nodes: [192.168.152.135:20160]
        You can destroy them with the command: `tiup cluster prune TiDBCluster`
root@ubuntu24:/TiDB#
root@ubuntu24:/TiDB# tiup cluster prune 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.129
+ [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.135
+ [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.135
+ [ Serial ] - FindTomestoneNodes
Will destroy these nodes: [192.168.152.135:20160]
Do you confirm this action? [y/N]:(default=N) y
Start destroy Tombstone nodes: [192.168.152.135:20160] ...
+ [ Serial ] - ClusterOperate: operation=ScaleInOperation, options={Roles:[] Nodes:[] Force:false SSHTimeout:5 OptTimeout:120 APITimeout:600 IgnoreConfigCheck:false NativeSSH:false SSHType: Concurrency:5 SSHProxyHost: SSHProxyPort:22 SSHProxyUser:root SSHProxyIdentity:/root/.ssh/id_rsa SSHProxyUsePassword:false SSHProxyTimeout:5 SSHCustomScripts:{BeforeRestartInstance:{Raw:} AfterRestartInstance:{Raw:}} CleanupData:false CleanupLog:false CleanupAuditLog:false RetainDataRoles:[] RetainDataNodes:[] DisplayMode:default Operation:StartOperation}
Stopping component tikv
        Stopping instance 192.168.152.135
        Stop tikv 192.168.152.135:20160 success
Destroying component tikv
        Destroying instance 192.168.152.135
Destroy 192.168.152.135 finished
- Destroy tikv paths: [/tidb-data/tikv-20160 /tidb-deploy/tikv-20160/log /tidb-deploy/tikv-20160 /etc/systemd/system/tikv-20160.service]
+ [ Serial ] - UpdateMeta: cluster=TiDBCluster, deleted=`'192.168.152.135:20160'`
+ [ Serial ] - UpdateTopology: 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.129
+ [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.135
+ Refresh instance configs
  - Generate config pd -> 192.168.152.126:2379 ... Done
+ Refresh 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 pd -> 192.168.152.135: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
+ Reload prometheus and grafana
  - Reload prometheus -> 192.168.152.134:9090 ... Done
  - Reload grafana -> 192.168.152.134:3000 ... Done
+ [ Serial ] - RemoveTomestoneNodesInPD
Destroy success
root@ubuntu24:/TiDB# 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.127:2379/dashboard
Dashboard URLs:     http://192.168.152.127:2379/dashboard
Grafana URL:        http://192.168.152.134:3000
ID                     Role          Host             Ports                 OS/Arch       Status   Data Dir                      Deploy Dir
--                     ----          ----             -----                 -------       ------   --------                      ----------
192.168.152.134:9093   alertmanager  192.168.152.134  9093/9094             linux/x86_64  Up       /tidb-data/alertmanager-9093  /tidb-deploy/alertmanager-9093
192.168.152.134:3000   grafana       192.168.152.134  3000                  linux/x86_64  Up       -                             /tidb-deploy/grafana-3000
192.168.152.126:2379   pd            192.168.152.126  2379/2380             linux/x86_64  Up       /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.127:2379   pd            192.168.152.127  2379/2380             linux/x86_64  Up|L|UI  /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.128:2379   pd            192.168.152.128  2379/2380             linux/x86_64  Up       /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.135:2379   pd            192.168.152.135  2379/2380             linux/x86_64  Up       /tidb-data/pd-2379            /tidb-deploy/pd-2379
192.168.152.134:9090   prometheus    192.168.152.134  9090/9115/9100/12020  linux/x86_64  Up       /tidb-data/prometheus-9090    /tidb-deploy/prometheus-9090
192.168.152.132:4000   tidb          192.168.152.132  4000/10080            linux/x86_64  Up       -                             /tidb-deploy/tidb-4000
192.168.152.133:4000   tidb          192.168.152.133  4000/10080            linux/x86_64  Up       -                             /tidb-deploy/tidb-4000
192.168.152.129:20160  tikv          192.168.152.129  20160/20180           linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.130:20160  tikv          192.168.152.130  20160/20180           linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
192.168.152.131:20160  tikv          192.168.152.131  20160/20180           linux/x86_64  Up       /tidb-data/tikv-20160         /tidb-deploy/tikv-20160
Total nodes: 12

image

5,缩容pd

缩容命令:tiup cluster scale-in TiDBCluster --node 192.168.152.135:2379

root@ubuntu24:/TiDB# tiup cluster scale-in TiDBCluster --node 192.168.152.135:2379
This operation will delete the 192.168.152.135:2379 nodes in `TiDBCluster` and all their data.
Do you want to continue? [y/N]:(default=N) y
Scale-in nodes...
+ [ 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.129
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.126
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.128
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.130
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.135
+ [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.131
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.134
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.127
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.132
+ [ Serial ] - ClusterOperate: operation=DestroyOperation, options={Roles:[] Nodes:[192.168.152.135:2379] Force:false SSHTimeout:5 OptTimeout:120 APITimeout:600 IgnoreConfigCheck:false NativeSSH:false SSHType: Concurrency:5 SSHProxyHost: SSHProxyPort:22 SSHProxyUser:root SSHProxyIdentity:/root/.ssh/id_rsa SSHProxyUsePassword:false SSHProxyTimeout:5 SSHCustomScripts:{BeforeRestartInstance:{Raw:} AfterRestartInstance:{Raw:}} CleanupData:false CleanupLog:false CleanupAuditLog:false RetainDataRoles:[] RetainDataNodes:[] DisplayMode:default Operation:StartOperation}
Stopping component pd
        Stopping instance 192.168.152.135
        Stop pd 192.168.152.135:2379 success
Destroying component pd
        Destroying instance 192.168.152.135
Destroy 192.168.152.135 finished
- Destroy pd paths: [/tidb-data/pd-2379 /tidb-deploy/pd-2379/log /tidb-deploy/pd-2379 /etc/systemd/system/pd-2379.service]
Stopping component node_exporter
        Stopping instance 192.168.152.135
        Stop 192.168.152.135 success
Stopping component blackbox_exporter
        Stopping instance 192.168.152.135
        Stop 192.168.152.135 success
Destroying monitored 192.168.152.135
        Destroying instance 192.168.152.135
Destroy monitored on 192.168.152.135 success
Delete public key 192.168.152.135
Delete public key 192.168.152.135 success
+ [ Serial ] - UpdateMeta: cluster=TiDBCluster, deleted=`'192.168.152.135:2379'`
+ [ Serial ] - UpdateTopology: 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.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.128
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.129
+ [Parallel] - UserSSH: user=tidb, host=192.168.152.132
+ Refresh instance configs
  - Generate config pd -> 192.168.152.126:2379 ... Done
+ Refresh 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
+ Reload prometheus and grafana
  - Reload prometheus -> 192.168.152.134:9090 ... Done
  - Reload grafana -> 192.168.152.134:3000 ... Done
Scaled cluster `TiDBCluster` in successfully
root@ubuntu24:/TiDB#

20260527备注:应该是上头了,昨晚上做梦都梦见扩容TiKV异常的问题,梦里也是各种排查,最近比较忙,有时间再重新测试tikv扩容的问题。