Issues with Data Distribution in TiKV Configuration Labels

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

Original topic: tikv配置labels数据分布问题

| username: mono

[TiDB Usage Environment] Production Environment
[TiDB Version] 7.1.1
[Reproduction Path] 3 physical machines running TiKV, each running 2 TiKV instances.
PD Configuration:
pd:
replication.location-labels:
- host
- zone

TiKV Configuration (6 instances using the following 3 configurations, with the same host configuration on the same physical server):
config:
server.labels:
host: tikv01
zone: zjtj

config:
server.labels:
host: tikv02
zone: zjtj

config:
server.labels:
host: tikv03
zone: zjtj

[Encountered Problem: Phenomenon and Impact] The 3 replicas of the data cannot be distributed across the 3 physical servers. Two replicas of a table are distributed on one physical machine, reducing the cluster’s availability.

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

Have you used the Placement Rules in SQL feature?
Also, isn’t the location-labels configuration file like this?
replication.location-labels: [“zone”, “host”]

| username: mono | Original post link

No placement rules used in SQL. PD and TiKV are configured with labels.

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

SHOW config WHERE NAME LIKE ‘%location-labels%’;
Let’s see what it is.

| username: mono | Original post link

The PD configuration did not take effect. Is it because the enable-placement-rule is enabled by default?

| username: mono | Original post link

±-----±--------------------±----------------------------±-------+
| Type | Instance | Name | Value |
±-----±--------------------±----------------------------±-------+
| pd | 172.20..:2379 | replication.location-labels | |
| pd | 172.20..:2379 | replication.location-labels | |
| pd | 172.20..:2379 | replication.location-labels | |

| username: mono | Original post link

±-----±-------------------±-----------------------------------------±------+
| Type | Instance | Name | Value |
±-----±-------------------±-----------------------------------------±------+
| pd | 172.20..:2379 | replication.enable-placement-rules | true |
±-----±-------------------±-----------------------------------------±------+

| username: mono | Original post link

It has been resolved. The configuration through tiup cluster edit-config did not take effect. Modifying the PD configuration through pd-ctl worked.

| username: Fly-bird | Original post link

It shouldn’t be, right?

| username: 大飞哥online | Original post link

You need to reload after editing the configuration with tiup cluster edit-config for the changes to take effect.

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

Your configuration seems incorrect…

| username: 大飞哥online | Original post link

Yes, PD’s location-labels = [“zone”, “rack”, “host”] is written as a string array. KV’s server.labels can be written in multiple lines.

| username: mono | Original post link

Folks, after using tiup cluster edit-config and reloading, I still can’t see the added labels configuration when checking the PD configuration with show config. After initializing the cluster, you need to use pd-ctl to change this configuration. If you don’t believe me, you can test it yourself!

| username: jansu-dev | Original post link

Here it is, the official website actually has a FAQ: TiDB Installation and Deployment FAQ | PingCAP Documentation Center

Posting it here for everyone’s convenience in searching!!

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

The official website has it written.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.