TiKV节点在线缩容

一、查看集群状态

 tiup cluster display cluster-default

二、进行缩容

# tiup cluster scale-in cluster-default  -N "x.x.x.x:20160"
Starting component `cluster`: /root/.tiup/components/cluster/v1.7.0/tiup-cluster scale-in cluster-default -N x.x.x.x:20160
This operation will delete the x.x.x.x:20160 nodes in `cluster-default` 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/cluster-default/ssh/id_rsa, publicKey=/root/.tiup/storage/cluster/clusters/cluster-default/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=x.x.x.x
+ [ Serial ] - ClusterOperate: operation=ScaleInOperation, options={Roles:[] Nodes:[x.x.x.x:20160] Force:false SSHTimeout:5 OptTimeout:120 APITimeout:300 IgnoreConfigCheck:false NativeSSH:false SSHType: Concurrency:5 SSHProxyHost: SSHProxyPort:22 SSHProxyUser:root SSHProxyIdentity:/root/.ssh/id_rsa SSHProxyUsePassword:false SSHProxyTimeout:5 CleanupData:false CleanupLog:false RetainDataRoles:[] RetainDataNodes:[] ShowUptime:false DisplayMode:default Operation:StartOperation}
The component `tikv` will become tombstone, maybe exists in several minutes or hours, after that you can use the prune command to clean it
+ [ Serial ] - UpdateMeta: cluster=cluster-default, deleted=`''`
+ [ Serial ] - UpdateTopology: cluster=cluster-default
+ Refresh instance configs
  - Regenerate config pd -> x.x.x.x:2379 ... Done
  - Regenerate config pd -> x.x.x.x:2379 ... Done
  - Regenerate config pd -> x.x.x.x:2379 ... Done
  - Regenerate config tikv -> x.x.x.x:20160 ... Done
  - Regenerate config tikv -> x.x.x.x:20160 ... Done
  - Regenerate config tikv -> x.x.x.x:20160 ... Done
  - Regenerate config tidb -> x.x.x.x:4000 ... Done
  - Regenerate config tiflash -> x.x.x.x:9000 ... Done
  - Regenerate config prometheus -> x.x.x.x:9090 ... Done
  - Regenerate config grafana -> x.x.x.x:3000 ... Done
  - Regenerate config alertmanager -> x.x.x.x:9093 ... Done
+ [ Serial ] - SystemCtl: host=x.x.x.x action=reload prometheus-9090.service
Scaled cluster `cluster-default` in successfully

三、销毁节点

Scale-in后,节点状态是Tombstone

 tiup cluster prune cluster-default  销毁

注: 如果Server在内网环境下,下线的时候代码中会访问"github.com/pingcap/tiup/pkg/cluster/executor"地址,所以会报错;

“"stderr": "", "__hash__": "1d1478dbec0d06ef5e909d3323331914538d4cb0", "__func__": "github.com/pingcap/tiup/pkg/cluster/executor.(*CheckPointExecutor).Execute", "hit": false}”

如果失败,可以添加--force强制销毁

 

tiup cluster prune cluster-default --force

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 TiDB 集群中增加 TiDB 节点TiKV 节点、PD 节点的步骤略有不同,下面分别介绍一下。 1. 增加 TiDB 节点 增加 TiDB 节点需要进行以下步骤: - 使用 TiUP 工具安装 TiDB-ansible,并在 inventory.ini 配置文件中添加新的 TiDB 节点信息。 - 在新的 TiDB 节点上安装 TiDB 组件,并在配置文件中设置与现有 TiDB 节点相同的参数。 - 将新的 TiDB 节点加入到 TiDB 集群中,需要使用 TiUP 工具执行 `tiup cluster scale-out <cluster-name> <new-tidb-instance>` 命令,其中 `<new-tidb-instance>` 是新的 TiDB 节点的名称。 - 等待 TiUP 工具完成 TiDB 节点的扩操作,然后使用 `tiup cluster display <cluster-name>` 命令检查集群状态,确保新的 TiDB 节点已经加入到集群中。 2. 增加 TiKV 节点 增加 TiKV 节点需要进行以下步骤: - 在新的服务器上安装 TiKV 组件,并在配置文件中设置与现有 TiKV 节点相同的参数。 - 将新的 TiKV 节点加入到 TiKV 集群中,需要在 TiKV 的配置文件中设置新的节点信息,并在现有 TiKV 节点上执行 `tiup cluster reload <cluster-name> tikv` 命令,让 TiKV 集群重新加载配置文件。 - 使用 TiUP 工具执行 `tiup cluster scale-out <cluster-name> <new-tikv-instance>` 命令,其中 `<new-tikv-instance>` 是新的 TiKV 节点的名称。 - 等待 TiUP 工具完成 TiKV 节点的扩操作,然后使用 `tiup cluster display <cluster-name>` 命令检查集群状态,确保新的 TiKV 节点已经加入到集群中。 3. 增加 PD 节点 增加 PD 节点需要进行以下步骤: - 在新的服务器上安装 PD 组件,并在配置文件中设置与现有 PD 节点相同的参数。 - 将新的 PD 节点加入到 PD 集群中,需要在 PD 配置文件中设置新的节点信息,并在现有 PD 节点上执行 `tiup cluster reload <cluster-name> pd` 命令,让 PD 集群重新加载配置文件。 - 使用 TiUP 工具执行 `tiup cluster scale-out <cluster-name> <new-pd-instance>` 命令,其中 `<new-pd-instance>` 是新的 PD 节点的名称。 - 等待 TiUP 工具完成 PD 节点的扩操作,然后使用 `tiup cluster display <cluster-name>` 命令检查集群状态,确保新的 PD 节点已经加入到集群中。 以上是增加 TiDB、TiKV、PD 节点的基本步骤,具体的操作可能会因为版本、网络环境等因素而有所不同,需要根据具体情况进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值