Re: How to add the `label` configuration if `label` of TiKV was not configured when I deployed the TiDB

47 views
Skip to first unread message
Message has been deleted
Message has been deleted

Chun Chen

unread,
Aug 3, 2018, 5:33:47 AM8/3/18
to TiDB user group
The configuration of TiDB `label` is related to the cluster deployment architecture. It is important and is the basis for PD to execute global management and scheduling. 

If you did not configure `label` when deploying the cluster previously, you can adjust the deployment structure by manually adding the `location-labels` information using the PD management tool `pd-ctl`. For example, `config set location-labels "zone, rack, host"`. You should configure it based on the practical `label` level name.

On Friday, August 3, 2018 at 4:53:50 PM UTC+8, Chun Chen wrote:


When I deployed the TiDB cluster for the first time, I did not configure `label` of TiKV. Now I want to add the `label` configuration but cannot find a way in TiDB documentation. What should I do? 

Menglong Huang

unread,
Aug 3, 2018, 5:59:18 AM8/3/18
to TiDB user group

First of all, you need to register location labels to PD. This is normally done by using pd-ctl:


» config show replication
{
 
"max-replicas": 3,
 
"location-labels": ""
}


» config set location-labels zone,host
Success!


» config show replication
{
 
"max-replicas": 3,
 
"location-labels": "zone,host"
}


Next you need to specify location labels for different tikv-servers. You can directly update the configuration files and restart all instances in turn. Here is the config example:

labels = { zone = "cn-west-1", host = "192.168.0.1" }

As an alternative, you can also set their labels using pd-ctl to avoid restarting:

» store 1
{
 
"store": {
   
"id": 1,
   
"address": "192.168.0.1:20161",
   
"version": "2.1.0-beta",
   
"state_name": "Up"
 
},
 
"status": {
   
"capacity": "10 GiB",
   
"available": "10 GiB",
   
"leader_count": 14,
   
"leader_weight": 1,
   
"leader_score": 14,
   
"leader_size": 14,
   
"region_count": 14,
   
"region_weight": 1,
   
"region_score": 14,
   
"region_size": 14,
   
"start_ts": "2018-08-03T17:35:06+08:00",
   
"last_heartbeat_ts": "2018-08-03T17:48:16.654551232+08:00",
   
"uptime": "13m10.654551232s"
 
}
}


» store label 1 zone cn-west-1
» store label 1 host 192.168.0.1
» store 1
{
 
"store": {
   
"id": 1,
   
"address": "192.168.0.1:20161",
   
"labels": [
     
{
       
"key": "zone",
       
"value": "cn-west-1"
     
},
     
{
       
"key": "host",
       
"value": "192.168.0.1"
     
}
   
],
   
"version": "2.1.0-beta",
   
"state_name": "Up"
 
},
 
"status": {
   
"capacity": "10 GiB",
   
"available": "10 GiB",
   
"leader_count": 14,
   
"leader_weight": 1,
   
"leader_score": 14,
   
"leader_size": 14,
   
"region_count": 14,
   
"region_weight": 1,
   
"region_score": 14,
   
"region_size": 14,
   
"start_ts": "2018-08-03T17:35:06+08:00",
   
"last_heartbeat_ts": "2018-08-03T17:48:46.85510699+08:00",
   
"uptime": "13m40.85510699s"
 
}
}

For more details, please refer to our documents:

在 2018年8月3日星期五 UTC+8下午5:33:47,Chun Chen写道:
Reply all
Reply to author
Forward
0 new messages