Error When Changing TiDB Cluster from Two Replicas to Three Replicas

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

Original topic: TiDB集群从两副本修改为三副本报错

| username: gary

[TiDB Usage Environment] Production Environment
[TiDB Version] v6.1.1
[Reproduction Path] Operations performed that led to the issue

  1. Cluster parameters have been modified and PD restarted:
    server_configs:
    pd:
    replication.max-replicas: 3

  2. Error when modifying to three replicas using pd-ctl
    » config set max-replicas 3
    Failed to set config: [400] “cannot update replication config, the default rules are not consistent with replication config, please update rule instead”

Configuration:



[Encountered Issue: Phenomenon and Impact]
Error when modifying to three replicas using pd-ctl
» config set max-replicas 3
Failed to set config: [400] “cannot update replication config, the default rules are not consistent with replication config, please update rule instead”

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

What is the current value of this parameter?

| username: gary | Original post link

SHOW config WHERE NAME LIKE ‘%max-replicas%’;

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

Now it is already 2 replicas, just wait for the replicas on the cluster to be reclaimed.

| username: gary | Original post link

No, I want to change from two replicas to three replicas.

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

Then change it to
SET config pd replication.max-replicas=3;
and wait for the replicas to be supplemented. You have 3 TiKV nodes, so setting it to 3 is fine.

| username: gary | Original post link

I tried this modification, but the same error occurred: “Failed to set config: [400] ‘cannot update replication config, the default rules do not consistent with replication config, please update rule instead.’”

| username: 有猫万事足 | Original post link

Try disabling placement rules first and then setting the number of replicas. Although this bug shouldn’t exist in 6.1.1, it’s worth a try.

>> pd-ctl config set enable-placement-rules false
>> pd-ctl config set max-replicas 3
| username: 小王同学Plus | Original post link

If placement rules are enabled (the Placement Rules feature is enabled by default in TiDB v5.0 and above), your version should have it enabled by default.

Either modify the rules through the placement rules interface or disable placement rules and set the replica rules using max-replicas.

| username: gary | Original post link

You should scale down TiFlash before shutting it down.

| username: gary | Original post link

To scale down TiFlash, disable placement rules, and then adjust max-replicas.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.