# Labels Configuration

![left](./student-guide/diagram/LabelConfiguration_aa_001_20220509.png)

------------------------------------------------------------
Above, we have understood the concept and function of labels. Next, let's take a look at how to set labels.
First, in the PD node, we need to identify the format information of the label, that is, the source information, as follows:

```
[replication]                     
location-labels = ["dc","zone", "rack", "host"] 
```

Among them, "dc", "rack" and "host" respectively indicate a data center, cabinet or rack and host, which are all physical locations or devices, which are very understandable.
However, the concept of "zone" is actually a logical concept used to denote the smallest location where replica can be isolated, and the number of them is always the same as that of replica. For example, if we have a default of 3 replicas, and if we have 3 data centers (DCs), then we set up 3 zones, each zone corresponding to a data center (DC), and the replica are placed in different zones. If we have 1 datacenter, but we have 3 racks, then we also set up 3 zones, one rack for each zone, and the replica are placed in different zones.
Second, let's take a look at the TiKV configuration. In the TiKV configuration,

```
tikv_servers:
  - host: 10.63.10.30
    config:
      server.labels: { dc: "1", zone: "1", rack: "1", host: "1" }
  - host: 10.63.10.31
    config:
      server.labels: { dc: "2", zone: "2", rack: "3", host: "6" }
  - host: 10.63.10.32
    config:
      server.labels: { dc: "3", zone: "3", rack: "5", host: "9" }
```

The interpretation is as follows:
Host: Rack 1 cabinet in the DC 1 data center where 10.63.10.30 is located, host number 1, zone number 1.
Host: Rack 3 cabinet at 10.63.10.31 in the DC 2 data center, host number 6, zone number 2.
Host: Rack 5 cabinet at 10.63.10.32 in the DC 3 data center, host number 9, zone number 3.
Based on previous knowledge, when the PD sees the location of the 3 hosts, it is possible to place 3 replica of the region on 3 host for maximum high availability.
