Adjusting TiDB Cluster Replicas (From Three Replicas to Two Replicas)

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB集群副本调整(由三副本调整为二副本)

| username: jingyesi3401

[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?

| username: 啦啦啦啦啦 | Original post link

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.

| username: xfworld | Original post link

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:

| username: ddhe9527 | Original post link

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.

| username: alfred | Original post link

It can be configured, but it is not recommended for production environments.

| username: TiDBer_o0MXVuK4 | Original post link

It should only be unusable if 2 nodes go down, right?

| username: tidb菜鸟一只 | Original post link

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.

| username: 裤衩儿飞上天 | Original post link

Don’t do this in a production environment, or you won’t be able to sleep at night.

| username: 特雷西-迈克-格雷迪 | Original post link

If there are only two replicas and two instances, if one goes down, can the remaining one be promoted to the primary replica?