Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiDB集群副本调整(由三副本调整为二副本)
[TiDB Usage Environment] Online, Testing, Research
[TiDB Version] v5.10.
[Encountered Problem] Due to limited storage space in production, the TiDB cluster is currently configured with 3 replicas by default, meaning each Region is stored 3 times in the cluster. Is it possible to adjust the TiDB cluster from three replicas to two replicas? What are the impacts, and are there any complete operation steps available for reference?
Refer to this for adjusting the number of replicas:
Note that having 2 replicas does not provide high availability. If one node goes down, the entire cluster will be unavailable. It is strongly recommended not to change this in a production environment.
After adjustment, it may affect data security, so it is not recommended to do this.
Adjust the global replica count:
Manually adjust the replica count:
Scale down all TiFlash nodes (if any). Note that you need to delete all TiFlash replicas before scaling down.
Edit the cluster topology file and add the following content under server_configs to disable placement rules and set the number of replicas to 2:
server_configs:
pd:
replication.enable-placement-rules: false
replication.max-replicas: 2
Then reload the cluster configuration and wait for PD scheduling.
If any one of the TiKV nodes fails with 2 replicas, the cluster will become unavailable.
It can be configured, but it is not recommended for production environments.
It should only be unusable if 2 nodes go down, right?
Doing this in a production database is really bold. Storage is not that expensive; adding some storage is much more cost-effective than taking this risk.
Don’t do this in a production environment, or you won’t be able to sleep at night.
If there are only two replicas and two instances, if one goes down, can the remaining one be promoted to the primary replica?