【TIDB】TICDC 缩容

1.检查现有的CDC 


[tidb@mysql1 ~]$ ps -ef |grep cdc
tidb      96609      1  0 16:56 ?        00:00:14 bin/cdc server --addr 0.0.0.0:8300 --advertise-addr 192.168.1.11:8300 --pd http://192.168.1.11:2379,http://192.168.1.12:2379,http://192.168.1.13:2379 --data-dir=/tidb/tidb-data/cdc-8300 --config conf/cdc.toml --log-file /tidb/tidb-deploy/cdc-8300/log/cdc.log
tidb     108544  44178  0 17:40 pts/1    00:00:00 grep --color=auto cdc
[root@mysql2 tidb-deploy]# ps -ef |grep cdc
tidb     124736      1  0 17:23 ?        00:00:01 bin/cdc server --addr 0.0.0.0:8300 --advertise-addr 192.168.1.12:8300 --pd http://192.168.1.11:2379,http://192.168.1.12:2379,http://192.168.1.13:2379 --data-dir=/tidb/tidb-data/cdc-8300 --config conf/cdc.toml --log-file /tidb/tidb-deploy/cdc-8300/log/cdc.log
root     125984   1766  0 17:26 pts/0    00:00:00 grep --color=auto cdc
[tidb@mysql1 ~]$ tiup cluster display tidbcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster display tidbcluster
Cluster type:       tidb
Cluster name:       tidbcluster
Cluster version:    v5.1.1
Deploy user:        tidb
SSH type:           builtin
Dashboard URL:      http://192.168.1.13:2379/dashboard
ID                  Role            Host          Ports                            OS/Arch       Status  Data Dir                           Deploy Dir
--                  ----            ----          -----                            -------       ------  --------                           ----------
192.168.1.11:9093   alertmanager    192.168.1.11  9093/9094                        linux/x86_64  Up      /tidb/tidb-data/alertmanager-9093  /tidb/tidb-deploy/alertmanager-9093
192.168.1.11:8300   cdc             192.168.1.11  8300                             linux/x86_64  Up      /tidb/tidb-data/cdc-8300           /tidb/tidb-deploy/cdc-8300
192.168.1.12:8300   cdc             192.168.1.12  8300                             linux/x86_64  Up      /tidb/tidb-data/cdc-8300           /tidb/tidb-deploy/cdc-8300
192.168.1.11:3000   grafana         192.168.1.11  3000                             linux/x86_64  Up      -                                  /tidb/tidb-deploy/grafana-3000
192.168.1.11:2379   pd              192.168.1.11  2379/2380                        linux/x86_64  Up      /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.12:2379   pd              192.168.1.12  2379/2380                        linux/x86_64  Up|L    /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.13:2379   pd              192.168.1.13  2379/2380                        linux/x86_64  Up|UI   /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.11:9090   prometheus      192.168.1.11  9090                             linux/x86_64  Up      /tidb/tidb-data/prometheus-9090    /tidb/tidb-deploy/prometheus-9090
192.168.1.11:4000   tidb            192.168.1.11  4000/10080                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4000
192.168.1.12:4001   tidb            192.168.1.12  4001/10081                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4001
192.168.1.13:4000   tidb            192.168.1.13  4000/10080                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4000
192.168.1.11:9000   tiflash         192.168.1.11  9000/8123/3930/20170/20292/8234  linux/x86_64  Up      /tidb/tidb-data/tiflash-9000       /tidb/tidb-deploy/tiflash-9000
192.168.1.14:9000   tiflash         192.168.1.14  9000/8123/3930/20170/20292/8234  linux/x86_64  Up      /tidb/tidb-data/tiflash-9000       /tidb/tidb-deploy/tiflash-9000
192.168.1.11:20160  tikv            192.168.1.11  20160/20180                      linux/x86_64  Up      /tidb/tidb-data/tikv-20160         /tidb/tidb-deploy/tikv-20160
192.168.1.12:20161  tikv            192.168.1.12  20161/20181                      linux/x86_64  Up      /tidb/tidb-data/tikv-20161         /tidb/tidb-deploy/tikv-20161
192.168.1.13:20160  tikv            192.168.1.13  20160/20180                      linux/x86_64  Up      /tidb/tidb-data/tikv-20160         /tidb/tidb-deploy/tikv-20160
192.168.1.11:7077   tispark-master  192.168.1.11  7077/8080                        linux/x86_64  Up      -                                  /tidb/tidb-deploy/tispark-master-7077
192.168.1.11:7078   tispark-worker  192.168.1.11  7078/8081                        linux/x86_64  Up      -                                  /tidb/tidb-deploy/tispark-worker-7078
Total nodes: 18

2.缩容 

删除一个CDC:12节点上的 
[tidb@mysql1 ~]$ tiup cluster scale-in tidbcluster --node 192.168.1.12:8300
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster scale-in tidbcluster --node 192.168.1.12:8300
This operation will delete the 192.168.1.12:8300 nodes in `tidbcluster` and all their data.
Do you want to continue? [y/N]:(default=N) y
Scale-in nodes...
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.14
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [ Serial ] - ClusterOperate: operation=ScaleInOperation, options={Roles:[] Nodes:[192.168.1.12:8300] Force:false SSHTimeout:5 OptTimeout:120 APITimeout:300 IgnoreConfigCheck:false NativeSSH:false SSHType: CleanupData:false CleanupLog:false RetainDataRoles:[] RetainDataNodes:[] ShowUptime:false JSON:false Operation:StartOperation}
Stopping component cdc
	Stopping instance 192.168.1.12
	Stop cdc 192.168.1.12:8300 success
Destroying component cdc
Destroying instance 192.168.1.12
Destroy 192.168.1.12 success
- Destroy cdc paths: [/tidb/tidb-data/cdc-8300 /tidb/tidb-deploy/cdc-8300/log /tidb/tidb-deploy/cdc-8300 /etc/systemd/system/cdc-8300.service]
+ [ Serial ] - UpdateMeta: cluster=tidbcluster, deleted=`'192.168.1.12:8300'`
+ [ Serial ] - UpdateTopology: cluster=tidbcluster
+ Refresh instance configs
  - Regenerate config pd -> 192.168.1.11:2379 ... Done
  - Regenerate config pd -> 192.168.1.12:2379 ... Done
  - Regenerate config pd -> 192.168.1.13:2379 ... Done
  - Regenerate config tikv -> 192.168.1.11:20160 ... Done
  - Regenerate config tikv -> 192.168.1.12:20161 ... Done
  - Regenerate config tikv -> 192.168.1.13:20160 ... Done
  - Regenerate config tidb -> 192.168.1.11:4000 ... Done
  - Regenerate config tidb -> 192.168.1.12:4001 ... Done
  - Regenerate config tidb -> 192.168.1.13:4000 ... Done
  - Regenerate config tiflash -> 192.168.1.11:9000 ... Done
  - Regenerate config tiflash -> 192.168.1.14:9000 ... Done
  - Regenerate config cdc -> 192.168.1.11:8300 ... Done
  - Regenerate config prometheus -> 192.168.1.11:9090 ... Done
  - Regenerate config grafana -> 192.168.1.11:3000 ... Done
  - Regenerate config alertmanager -> 192.168.1.11:9093 ... Done
  - Regenerate config tispark -> 192.168.1.11:7077 ... Done
  - Regenerate config tispark -> 192.168.1.11:7078 ... Done
+ [ Serial ] - SystemCtl: host=192.168.1.11 action=reload prometheus-9090.service
Scaled cluster `tidbcluster` in successfully

3.检查当前的cdc; 

--当前只有一个CDC;
[tidb@mysql1 ~]$ tiup cluster display tidbcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster display tidbcluster
Cluster type:       tidb
Cluster name:       tidbcluster
Cluster version:    v5.1.1
Deploy user:        tidb
SSH type:           builtin
Dashboard URL:      http://192.168.1.13:2379/dashboard
ID                  Role            Host          Ports                            OS/Arch       Status  Data Dir                           Deploy Dir
--                  ----            ----          -----                            -------       ------  --------                           ----------
192.168.1.11:9093   alertmanager    192.168.1.11  9093/9094                        linux/x86_64  Up      /tidb/tidb-data/alertmanager-9093  /tidb/tidb-deploy/alertmanager-9093
192.168.1.11:8300   cdc             192.168.1.11  8300                             linux/x86_64  Up      /tidb/tidb-data/cdc-8300           /tidb/tidb-deploy/cdc-8300
192.168.1.11:3000   grafana         192.168.1.11  3000                             linux/x86_64  Up      -                                  /tidb/tidb-deploy/grafana-3000
192.168.1.11:2379   pd              192.168.1.11  2379/2380                        linux/x86_64  Up      /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.12:2379   pd              192.168.1.12  2379/2380                        linux/x86_64  Up|L    /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.13:2379   pd              192.168.1.13  2379/2380                        linux/x86_64  Up|UI   /tidb/tidb-data/pd-2379            /tidb/tidb-deploy/pd-2379
192.168.1.11:9090   prometheus      192.168.1.11  9090                             linux/x86_64  Up      /tidb/tidb-data/prometheus-9090    /tidb/tidb-deploy/prometheus-9090
192.168.1.11:4000   tidb            192.168.1.11  4000/10080                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4000
192.168.1.12:4001   tidb            192.168.1.12  4001/10081                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4001
192.168.1.13:4000   tidb            192.168.1.13  4000/10080                       linux/x86_64  Up      -                                  /tidb/tidb-deploy/tidb-4000
192.168.1.11:9000   tiflash         192.168.1.11  9000/8123/3930/20170/20292/8234  linux/x86_64  Up      /tidb/tidb-data/tiflash-9000       /tidb/tidb-deploy/tiflash-9000
192.168.1.14:9000   tiflash         192.168.1.14  9000/8123/3930/20170/20292/8234  linux/x86_64  Up      /tidb/tidb-data/tiflash-9000       /tidb/tidb-deploy/tiflash-9000
192.168.1.11:20160  tikv            192.168.1.11  20160/20180                      linux/x86_64  Up      /tidb/tidb-data/tikv-20160         /tidb/tidb-deploy/tikv-20160
192.168.1.12:20161  tikv            192.168.1.12  20161/20181                      linux/x86_64  Up      /tidb/tidb-data/tikv-20161         /tidb/tidb-deploy/tikv-20161
192.168.1.13:20160  tikv            192.168.1.13  20160/20180                      linux/x86_64  Up      /tidb/tidb-data/tikv-20160         /tidb/tidb-deploy/tikv-20160
192.168.1.11:7077   tispark-master  192.168.1.11  7077/8080                        linux/x86_64  Up      -                                  /tidb/tidb-deploy/tispark-master-7077
192.168.1.11:7078   tispark-worker  192.168.1.11  7078/8081                        linux/x86_64  Up      -                                  /tidb/tidb-deploy/tispark-worker-7078
Total nodes: 17

4.重启集群验证是否正常 

[tidb@mysql1 ~]$ tiup cluster restart tidbcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster restart tidbcluster
Will restart the cluster tidbcluster with nodes:  roles: .
Do you want to continue? [y/N]:(default=N) y
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.14
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [ Serial ] - RestartCluster
Stopping component tispark
	Stopping instance 192.168.1.11
	Stop tispark 192.168.1.11:7078 success
Stopping component tispark
	Stopping instance 192.168.1.11
	Stop tispark 192.168.1.11:7077 success
Stopping component alertmanager
	Stopping instance 192.168.1.11
	Stop alertmanager 192.168.1.11:9093 success
Stopping component grafana
	Stopping instance 192.168.1.11
	Stop grafana 192.168.1.11:3000 success
Stopping component prometheus
	Stopping instance 192.168.1.11
	Stop prometheus 192.168.1.11:9090 success
Stopping component cdc
	Stopping instance 192.168.1.11
	Stop cdc 192.168.1.11:8300 success
Stopping component tiflash
	Stopping instance 192.168.1.14
	Stopping instance 192.168.1.11
	Stop tiflash 192.168.1.14:9000 success
	Stop tiflash 192.168.1.11:9000 success
Stopping component tidb
	Stopping instance 192.168.1.13
	Stopping instance 192.168.1.11
	Stopping instance 192.168.1.12
	Stop tidb 192.168.1.11:4000 success
	Stop tidb 192.168.1.13:4000 success
	Stop tidb 192.168.1.12:4001 success
Stopping component tikv
	Stopping instance 192.168.1.13
	Stopping instance 192.168.1.11
	Stopping instance 192.168.1.12
	Stop tikv 192.168.1.11:20160 success
	Stop tikv 192.168.1.13:20160 success
	Stop tikv 192.168.1.12:20161 success
Stopping component pd
	Stopping instance 192.168.1.13
	Stopping instance 192.168.1.11
	Stopping instance 192.168.1.12
	Stop pd 192.168.1.12:2379 success
	Stop pd 192.168.1.11:2379 success
	Stop pd 192.168.1.13:2379 success
Stopping component node_exporter
	Stopping instance 192.168.1.14
	Stopping instance 192.168.1.11
	Stopping instance 192.168.1.12
	Stopping instance 192.168.1.13
	Stop 192.168.1.11 success
	Stop 192.168.1.12 success
	Stop 192.168.1.14 success
	Stop 192.168.1.13 success
Stopping component blackbox_exporter
	Stopping instance 192.168.1.14
	Stopping instance 192.168.1.11
	Stopping instance 192.168.1.12
	Stopping instance 192.168.1.13
	Stop 192.168.1.12 success
	Stop 192.168.1.14 success
	Stop 192.168.1.13 success
	Stop 192.168.1.11 success
Starting component pd
	Starting instance 192.168.1.13:2379
	Starting instance 192.168.1.11:2379
	Starting instance 192.168.1.12:2379
	Start instance 192.168.1.13:2379 success
	Start instance 192.168.1.12:2379 success
	Start instance 192.168.1.11:2379 success
Starting component tikv
	Starting instance 192.168.1.13:20160
	Starting instance 192.168.1.11:20160
	Starting instance 192.168.1.12:20161
	Start instance 192.168.1.13:20160 success
	Start instance 192.168.1.12:20161 success
	Start instance 192.168.1.11:20160 success
Starting component tidb
	Starting instance 192.168.1.13:4000
	Starting instance 192.168.1.11:4000
	Starting instance 192.168.1.12:4001
	Start instance 192.168.1.12:4001 success
	Start instance 192.168.1.13:4000 success
	Start instance 192.168.1.11:4000 success
Starting component tiflash
	Starting instance 192.168.1.14:9000
	Starting instance 192.168.1.11:9000
	Start instance 192.168.1.14:9000 success
	Start instance 192.168.1.11:9000 success
Starting component cdc
	Starting instance 192.168.1.11:8300
	Start instance 192.168.1.11:8300 success
Starting component prometheus
	Starting instance 192.168.1.11:9090
	Start instance 192.168.1.11:9090 success
Starting component grafana
	Starting instance 192.168.1.11:3000
	Start instance 192.168.1.11:3000 success
Starting component alertmanager
	Starting instance 192.168.1.11:9093
	Start instance 192.168.1.11:9093 success
Starting component tispark
	Starting instance 192.168.1.11:7077
	Start instance 192.168.1.11:7077 success
Starting component tispark
	Starting instance 192.168.1.11:7078
	Start instance 192.168.1.11:7078 success
Starting component node_exporter
	Starting instance 192.168.1.14
	Starting instance 192.168.1.11
	Starting instance 192.168.1.12
	Starting instance 192.168.1.13
	Start 192.168.1.12 success
	Start 192.168.1.14 success
	Start 192.168.1.13 success
	Start 192.168.1.11 success
Starting component blackbox_exporter
	Starting instance 192.168.1.14
	Starting instance 192.168.1.11
	Starting instance 192.168.1.12
	Starting instance 192.168.1.13
	Start 192.168.1.12 success
	Start 192.168.1.14 success
	Start 192.168.1.13 success
	Start 192.168.1.11 success
Restarted cluster `tidbcluster` successfully

+---------+--------------------+--------------------+---------+------------------------------------------+---------------------------+-----------------+-----------+
| TYPE    | INSTANCE           | STATUS_ADDRESS     | VERSION | GIT_HASH                                 | START_TIME                | UPTIME          | SERVER_ID |
+---------+--------------------+--------------------+---------+------------------------------------------+---------------------------+-----------------+-----------+
| tidb    | 192.168.1.13:4000  | 192.168.1.13:10080 | 5.1.1   | 797bddd25310ed42f0791c8eccb78be8cce2f502 | 2024-08-16T17:45:16+08:00 | 1m24.445552981s |         0 |
| tidb    | 192.168.1.12:4001  | 192.168.1.12:10081 | 5.1.1   | 797bddd25310ed42f0791c8eccb78be8cce2f502 | 2024-08-16T17:45:16+08:00 | 1m24.44555955s  |         0 |
| tidb    | 192.168.1.11:4000  | 192.168.1.11:10080 | 5.1.1   | 797bddd25310ed42f0791c8eccb78be8cce2f502 | 2024-08-16T17:45:16+08:00 | 1m24.445561063s |         0 |
| pd      | 192.168.1.13:2379  | 192.168.1.13:2379  | 5.1.1   | 7cba1912b317a533e18b16ea2ba9a14ed2891129 | 2024-08-16T17:45:02+08:00 | 1m38.445562573s |         0 |
| pd      | 192.168.1.11:2379  | 192.168.1.11:2379  | 5.1.1   | 7cba1912b317a533e18b16ea2ba9a14ed2891129 | 2024-08-16T17:45:02+08:00 | 1m38.445563861s |         0 |
| pd      | 192.168.1.12:2379  | 192.168.1.12:2379  | 5.1.1   | 7cba1912b317a533e18b16ea2ba9a14ed2891129 | 2024-08-16T17:45:02+08:00 | 1m38.445565261s |         0 |
| tiflash | 192.168.1.14:3930  | 192.168.1.14:20292 | v5.1.1  | c8fabfb50fe28db17cc5118133a69be255c40efd | 2024-08-16T17:45:27+08:00 | 1m13.445566604s |         0 |
| tikv    | 192.168.1.12:20161 | 192.168.1.12:20181 | 5.1.1   | 4705d7c6e9c42d129d3309e05911ec6b08a25a38 | 2024-08-16T17:45:06+08:00 | 1m34.445567865s |         0 |
| tikv    | 192.168.1.13:20160 | 192.168.1.13:20180 | 5.1.1   | 4705d7c6e9c42d129d3309e05911ec6b08a25a38 | 2024-08-16T17:45:06+08:00 | 1m34.445569132s |         0 |
| tikv    | 192.168.1.11:20160 | 192.168.1.11:20180 | 5.1.1   | 4705d7c6e9c42d129d3309e05911ec6b08a25a38 | 2024-08-16T17:45:06+08:00 | 1m34.445570451s |         0 |
| tiflash | 192.168.1.11:3930  | 192.168.1.11:20292 | v5.1.1  | c8fabfb50fe28db17cc5118133a69be255c40efd | 2024-08-16T17:45:27+08:00 | 1m13.445571718s |         0 |
+---------+--------------------+--------------------+---------+------------------------------------------+---------------------------+-----------------+-----------+
11 rows in set (0.01 sec)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值