【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】
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.
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.
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?
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.
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?
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.