怎样配置tidb节点的标签? Stale Read 就近读取数据

【 TiDB 使用环境】生产\测试环境\ POC
【 TiDB 版本】

MySQL > select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.3.0
Edition: Community
Git Commit Hash: 4a1b2e9fe5b5afb1068c56de47adb07098d768d6
Git Branch: heads/refs/tags/v5.3.0
UTC Build Time: 2021-11-24 13:32:39
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

【遇到的问题】
怎样配置tidb节点的标签。

[root@pd yamlfile]# cat scale-out.yaml 
tidb_servers:
- host: 10.150.57.95
  config:
    server.labels:
      zone: sh
[root@pd yamlfile]# 
执行check没有问题。
[root@pd yamlfile]# tiup cluster check scale-out.yaml 
Starting component `cluster`: /root/.tiup/components/cluster/v1.9.0/tiup-cluster check scale-out.yaml

+ Detect CPU Arch
  - Detecting node 10.150.57.95 ... Done
+ Download necessary tools
  - Downloading check tools for linux/amd64 ... Done
+ Collect basic system information
+ Collect basic system information
  - Getting system info of 10.150.57.95:22 ... Done
+ Check system requirements
+ Check system requirements
+ Check system requirements
+ Check system requirements
  - Checking node 10.150.57.95 ... Done
+ Cleanup check files
  - Cleanup check files on 10.150.57.95:22 ... Done
Node          Check         Result  Message
----          -----         ------  -------
10.150.57.95  command       Fail    numactl not usable, bash: numactl: command not found
10.150.57.95  cpu-cores     Pass    number of CPU cores / threads: 16
10.150.57.95  cpu-governor  Warn    Unable to determine current CPU frequency governor policy
10.150.57.95  memory        Pass    memory size is 65536MB
10.150.57.95  limits        Fail    soft limit of 'nofile' for user 'tidb' is not set or too low
10.150.57.95  limits        Fail    hard limit of 'nofile' for user 'tidb' is not set or too low
10.150.57.95  limits        Fail    soft limit of 'stack' for user 'tidb' is not set or too low
10.150.57.95  sysctl        Fail    net.core.somaxconn = 128, should be greater than 32768
10.150.57.95  sysctl        Fail    net.ipv4.tcp_syncookies = 1, should be 0
10.150.57.95  service       Fail    service irqbalance is not running
10.150.57.95  os-version    Pass    OS is CentOS Linux 7 (Core) 7.8.2003
10.150.57.95  swap          Fail    swap is enabled, please disable it for best performance
10.150.57.95  selinux       Pass    SELinux is disabled
10.150.57.95  thp           Fail    THP is enabled, please disable it for best performance

Found cluster newer version:
        The latest version:         v1.11.0
        Local installed version:    v1.9.0
        Update current component:   tiup update cluster
        Update all components:      tiup update --all
[root@pd yamlfile]# 
扩展出来的时候,出现了问题。
扩展的报错信息如下:
+ Copy certificate to remote host
+ Generate scale-out config
  - Generate scale-out config tidb -> 10.150.57.95:4000 ... Error

Error: executor.ssh.execute_failed: Failed to execute command over SSH for 'root@10.150.57.95:22' {ssh_stderr: , ssh_stdout: [2022/10/29 10:52:02.241 +08:00] [FATAL] [terror.go:292] ["unexpected error"] [error="config file /vdb/tidb-deploy/tidb-4000/conf/tidb.toml contained invalid configuration options: server, server.labels, server.labels.zone; check TiDB manual to make sure this option has not been deprecated and removed from your TiDB version if the option does not appear to be a typo"] [stack="github.com/pingcap/tidb/parser/terror.MustNil\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292\ngithub.com/pingcap/tidb/config.InitializeConfig\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/config/config.go:796\nmain.main\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/tidb-server/main.go:177\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:225"] [stack="github.com/pingcap/tidb/parser/terror.MustNil\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292\ngithub.com/pingcap/tidb/config.InitializeConfig\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/config/config.go:796\nmain.main\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/tidb-server/main.go:177\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:225"]
, ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin /vdb/tidb-deploy/tidb-4000/bin/tidb-server --config-check --config=/vdb/tidb-deploy/tidb-4000/conf/tidb.toml }, cause: Process exited with status 1: check config failed

Verbose debug logs has been written to /root/.tiup/logs/tiup-cluster-debug-2022-10-29-10-52-02.log.

Found cluster newer version:
        The latest version:         v1.11.0
        Local installed version:    v1.9.0
        Update current component:   tiup update cluster
        Update all components:      tiup update --all
Error: run `/root/.tiup/components/cluster/v1.9.0/tiup-cluster` (wd:/root/.tiup/data/TLcK5ve) failed: exit status 1
[root@pd yamlfile]#

参考文档:
在三数据中心下就近读取数据 | PingCAP Docs

【复现路径】做过哪些操作出现的问题
【问题现象及影响】

tidb_server
config:
labels: { city: “xian”}

1 个赞

好用 谢谢~

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。