Could the experts please explain the function of server.labels?

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

Original topic: 请大佬们帮忙解释一下server.labels的作用

| username: tidb狂热爱好者

[TiDB Usage Environment] Production Environment / Testing / Poc
[TiDB Version]
[Reproduction Path] What operations were performed to cause the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

Original 3 TiKV nodes:
tikv_servers:

  • host: 10.12.82.22
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: a
    host: host1
    rack: rack1
    zone: ap-northeast-1a
    arch: amd64
    os: linux
  • host: 10.12.80.11
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: c
    host: host2
    rack: rack1
    zone: ap-northeast-1c
    arch: amd64
    os: linux
  • host: 10.12.81.4
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: d
    host: host3
    rack: rack1
    zone: ap-northeast-1d
    arch: amd64
    os: linux

Newly added:

tikv_servers:

  • host: 10.12.82.2
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: a
    host: host4
    rack: rack1
    zone: ap-northeast-1a
    arch: amd64
    os: linux
  • host: 10.12.80.1
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: c
    host: host5
    rack: rack1
    zone: ap-northeast-1c
    arch: amd64
    os: linux
  • host: 10.12.81.1
    ssh_port: 22
    port: 20160
    status_port: 20180
    deploy_dir: /tidb/tidb-deploy/tikv-20160
    data_dir: /tidb/tidb-data/tikv-20160
    log_dir: /tidb/tidb-deploy/tikv-20160/log
    config:
    server.labels:
    dc: d
    host: host6
    rack: rack1
    zone: ap-northeast-1d
    arch: amd64
    os: linux

Is this correct? What do dc, host, and rack correspond to respectively?

| username: tidb狂热爱好者 | Original post link

pd:
replication.location-labels:
- zone
- dc
- rack
- host

| username: WalterWj | Original post link

Label is a soft limit. Placement Rules use location labels to describe the physical location information of TiKV instances. The reasonable distribution of data replicas across different regions, data centers, racks, and hosts will degrade if not met. This is the difference between availability zones, data centers, racks, and machines.

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

| username: WinterLiu | Original post link

The configuration of dc host rack needs to be done in the replication.location-labels setting in PD.

| username: tony5413 | Original post link

dc corresponds to data centers such as Beijing, Tokyo, New York
host corresponds to servers
rack corresponds to racks

| username: tidb狂热爱好者 | Original post link

Will the version strictly follow this execution?