Single Availability Zone with Three AZs, Replica Count Not Configured, What Should the Actual Count Be?

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

Original topic: 单可用区三AZ,副本数量没用配置,实际应该是多少

| username: bryanz

【TiDB Usage Environment】Testing
【TiDB Version】v7.1.1
【Reproduction Path】None
【Encountered Problem: Phenomenon and Impact】Environment: Single availability zone with three AZs. Are there still 3 copies of the data replicas below, equivalent to 3 replicas across 3 availability zones? Are there a total of 9 data replicas? My ctl shows the current replica count is 3.
【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】

| username: 像风一样的男子 | Original post link

If you correctly label the KV according to 3 AZs, then it will be three replicas, with each AZ having a complete replica. If all KVs under a certain AZ fail, it will not affect the use of the entire database.

| username: bryanz | Original post link

Tagged

  • host: 192.168.1.100
    ssh_port: 22
    port: 30402
    status_port: 30403
    deploy_dir: “/zol/tidb-deploy/tikv”
    data_dir: “/zol/tidb-data/tikv”
    log_dir: “/zol/tidb-deploy/tikv/log”
    config:
    server.labels:
    zone: zol1
    host: 192.168.1.100

  • host: 192.168.1.101
    ssh_port: 22
    port: 30402
    status_port: 30403
    deploy_dir: “/zol/tidb-deploy/tikv”
    data_dir: “/zol/tidb-data/tikv”
    log_dir: “/zol/tidb-deploy/tikv/log”
    config:
    server.labels:
    zone: zol1
    host: 192.168.1.101

  • host: 192.168.1.102
    ssh_port: 22
    port: 30402
    status_port: 30403
    deploy_dir: “/zol/tidb-deploy/tikv”
    data_dir: “/zol/tidb-data/tikv”
    log_dir: “/zol/tidb-deploy/tikv/log”
    config:
    server.labels:
    zone: zol3
    host: 192.168.1.102

| username: 小龙虾爱大龙虾 | Original post link

3 replicas mean 3 copies.

| username: bryanz | Original post link

I am using a single availability zone with a three AZ deployment architecture. How many replicas should there be?

| username: 小龙虾爱大龙虾 | Original post link

It has nothing to do with your physical deployment architecture. The number of replicas specified by your max-replicas is the number of replicas.

| username: 芮芮是产品 | Original post link

A single availability zone means a single AZ. This classification can be based on racks, data centers, or cities. AZ is the term used by AWS, which refers to different data centers.

| username: bryanz | Original post link

How can we determine if the replicas are in the same availability zone?

| username: bryanz | Original post link

What I mean is the TiDB AZ deployment architecture. In the case of multiple AZs, are the replicas distributed across 3 AZs, or are there three replicas within a single AZ?

| username: 小龙虾爱大龙虾 | Original post link

The PD monitoring panel has an isolation level panel where you can see the current isolation level of the region.

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

Check here, you can schedule regions through PD’s replication.location-labels and TiKV labeling. Based on the above configuration, scheduling will be done as follows:

If you currently have only 2 zones but three replicas, the zones do not meet the requirements, so they will be allocated based on the host, with one replica per host. You can expand to another zone, zol2, and then you should see one replica per zone.

| username: bryanz | Original post link

Thank you, master. In this case, 3 zones would mean 3 replicas. If 2 zones are scheduled according to hosts, then one zone with 3 replicas and 2 zones would mean 6 replicas, right?

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

Learned a new trick.

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

No, the number of replicas is fixed. If you set it to 3, it will be 3. However, if you label them for zone-level isolation and host-level isolation, but the number of zones is insufficient, you won’t be able to isolate replicas according to the zone level and will have to do it according to the host level.

For example, if you set the replicas to 3 but only have 2 zones and 3 hosts, your replicas can only be stored on three different hosts.


However, if you add one more zone with 2 hosts, you will have 3 zones and 5 hosts. Then, your 3 replicas will be distributed across the 3 zones, but which host within each zone is not determined.

| username: dba远航 | Original post link

3 replicas mean 3 copies: one leader and two followers.

| username: come_true | Original post link

At least 3 replicas, or an odd number of replicas.