# [Known Issues] Updating max-replicas config, reported "the default rules do not consistent with replication config, please update rule instead"

## Key Words

max-replicas, placement rules

## Description

通过命令“$ ./pd-ctl -u <http://XX.XX.XX.XX:2379> config set max-replicas 3”将 max-replicas 从 1 更改为 3，但遇到如下错误：

```golang
Failed to set config: [400] "cannot to update replication config, the default rules do not consistent with replication config, please update rule instead"
```

## Root Cause

启用 Placement Rules 后（必须真正开启 placement-rule，即 enable-placement-rule = true ，并且存在 TiFlash 表；或者设置了 placement-rule 的相关规则），之前配置的 max-replicas 和 location-labels 不再生效。调整副本策略，使用Placement Rules 相关接口。

## Diagnostic Steps

1. 检查 Placement Rules 是否启用？是的，已启用

    ```json
    pd-ctl -u http://XX.XX.XX.XX:2379 config show replication
     
    {
      "max-replicas": 1,
      "location-labels": "",
      "strictly-match-label": "false",
      "enable-placement-rules": "true",
      "isolation-level": ""
    }
    ```

2. 检查放置规则中的副本设置：副本为1

    ```json
    pd-ctl -u http://XX.XX.XX.XX:2379 config placement-rules show
     
    [
      {
        "group_id": "pd",
        "id": "default",
        "start_key": "",
        "end_key": "",
        "role": "voter",
        "count": 1
      }
    ]
    ```

## Resolution

使用与 Placement Rules 相关的接口。

1. 运行命令 `./pd-ctl -u http://XX.XX.XX.XX:2379 config placement save --in=new_rules.json`

    new_rules.json 内容如下，副本数从 1 改为 3

    ```json
    [
      {
        "group_id": "pd",
        "id": "default",
        "start_key": "",
        "end_key": "",
        "role": "voter",
        "count": 3
      }
    ]
    ```

2.保持监视 PD dashboard -> "Current peer count"，计数应该增加。