# 2021-07-23-16:38:29+0800 scale-in cloudchat tikv replicas from 24 to 21

- Cause: https://jira.tidbcloud.com/projects/TCOC/issues/TCOC-131
- Operation:

exeucte the following sql against metadb:

```sql
START TRANSACTION;
INSERT INTO `cluster_operations` (`created_at`,`updated_at`,`cluster_id`,`type`,`completed_at`,`status`,`content`) VALUES ('2021-07-23 18:21:58.463','2021-07-23 18:21:58.463','1311285575352848384','scale',NULL,'created','');
INSERT INTO `machines` (`created_at`,`updated_at`,`name`,`instance_id`,`machine_profile_id`,`zone_id`,`status`,`id`) VALUES ('2021-04-07 23:34:10','2021-04-06 14:50:09','1311285575352848384-tikv','','8','174665','running','1620001') ON DUPLICATE KEY UPDATE `id`=`id`;
UPDATE `component_machines` SET `machine_id`='1620001',`status`='deleted',`updated_at`='2021-07-23 18:22:02.211' WHERE `id` = '1620001';
INSERT INTO `machines` (`created_at`,`updated_at`,`name`,`instance_id`,`machine_profile_id`,`zone_id`,`status`,`id`) VALUES ('2021-04-07 23:34:10','2021-04-06 14:50:09','1311285575352848384-tikv','','8','174667','running','1620002') ON DUPLICATE KEY UPDATE `id`=`id`;
UPDATE `component_machines` SET `machine_id`='1620002',`status`='deleted',`updated_at`='2021-07-23 18:22:04.834' WHERE `id` = '1620002';
INSERT INTO `machines` (`created_at`,`updated_at`,`name`,`instance_id`,`machine_profile_id`,`zone_id`,`status`,`id`) VALUES ('2021-04-07 23:34:10','2021-04-06 14:50:09','1311285575352848384-tikv','','8','204666','running','1620003') ON DUPLICATE KEY UPDATE `id`=`id`;
UPDATE `component_machines` SET `machine_id`='1620003',`status`='deleted',`updated_at`='2021-07-23 18:22:07.607' WHERE `id` = '1620003';
INSERT INTO `scale_operation_trackings` (`created_at`,`updated_at`,`component_id`,`cluster_operation_id`,`status`,`replicas`) VALUES ('2021-07-23 18:22:13.093','2021-07-23 18:22:13.093',610,'120001','scale-init',21);
UPDATE `clusters` SET `status`='scaling',`updated_at`='2021-07-23 18:22:15.641' WHERE id = '1311285575352848384' AND status NOT IN ('deleted','deletecomplete','cleared');
INSERT INTO `audit_logs` (`created_at`,`tenant_id`,`user`,`content`) VALUES ('2021-07-23 18:22:17','1311265642040528896','wuyelei@pingcap.com','scale cluster: 1311285575352848384, detail:  tikv replicas: 21, ');
COMMIT;
```

change the configuration of TiKV, set `backup.num-threads` to 8

```
kubectl edit tc -n tidb1311285575352848384 db
```

- Impact: the TiKV cluster will be scaled to 21 and the TiKV cluster will be rolling-updated
- Recovery operation: N/A
- Time window: 2021-07-25 02:00-08:00
