kv服务器上region数量不均衡

监控显示如下图所示:

pdctl查询如下:

[tidb@dev10 ~]$ /home/tidb/tidb-ansible/resources/bin/pd-ctl -u "http://192.168.180.33:2379" -d store
{
  "count": 5,
  "stores": [
    {
      "store": {
        "id": 33067,
        "address": "192.168.180.52:20160",
        "version": "3.0.5",
        "state_name": "Up"
      },
      "status": {
        "capacity": "392.7GiB",
        "available": "345.4GiB",
        "leader_count": 252,
        "leader_weight": 1,
        "leader_score": 5783,
        "leader_size": 5783,
        "region_count": 2702,
        "region_weight": 1,
        "region_score": 17440,
        "region_size": 17440,
        "start_ts": "2020-01-07T17:52:21+08:00",
        "last_heartbeat_ts": "2020-01-15T14:35:24.405174571+08:00",
        "uptime": "188h43m3.405174571s"
      }
    },
    {
      "store": {
        "id": 72015,
        "address": "192.168.180.51:20160",
        "version": "3.0.5",
        "state_name": "Up"
      },
      "status": {
        "capacity": "392.7GiB",
        "available": "249.5GiB",
        "leader_count": 783,
        "leader_weight": 1,
        "leader_score": 5798,
        "leader_size": 5798,
        "region_count": 3185,
        "region_weight": 1,
        "region_score": 17442,
        "region_size": 17442,
        "start_ts": "2020-01-07T17:53:36+08:00",
        "last_heartbeat_ts": "2020-01-15T14:35:25.318688586+08:00",
        "uptime": "188h41m49.318688586s"
      }
    },
    {
      "store": {
        "id": 72014,
        "address": "192.168.180.53:20160",
        "version": "3.0.5",
        "state_name": "Up"
      },
      "status": {
        "capacity": "392.7GiB",
        "available": "378.8GiB",
        "leader_count": 3319,
        "leader_weight": 1,
        "leader_score": 5820,
        "leader_size": 5820,
        "region_count": 4952,
        "region_weight": 1,
        "region_score": 17388,
        "region_size": 17388,
        "start_ts": "2020-01-08T22:13:32+08:00",
        "last_heartbeat_ts": "2020-01-15T14:35:20.753902242+08:00",
        "uptime": "160h21m48.753902242s"
      }
    },
    {
      "store": {
        "id": 88873,
        "address": "192.168.180.58:20160",
        "version": "3.0.5",
        "state_name": "Up"
      },
      "status": {
        "capacity": "99.95GiB",
        "available": "92.14GiB",
        "leader_count": 1454,
        "leader_weight": 1,
        "leader_score": 5808,
        "leader_size": 5808,
        "region_count": 3624,
        "region_weight": 1,
        "region_score": 17399,
        "region_size": 17399,
        "start_ts": "2020-01-10T10:00:02+08:00",
        "last_heartbeat_ts": "2020-01-15T14:35:27.133080891+08:00",
        "uptime": "124h35m25.133080891s"
      }
    },
    {
      "store": {
        "id": 88874,
        "address": "192.168.180.59:20160",
        "version": "3.0.5",
        "state_name": "Up"
      },
      "status": {
        "capacity": "99.95GiB",
        "available": "95.56GiB",
        "leader_count": 602,
        "leader_weight": 1,
        "leader_score": 5809,
        "leader_size": 5809,
        "region_count": 4767,
        "region_weight": 1,
        "region_score": 17385,
        "region_size": 17385,
        "start_ts": "2020-01-10T10:00:02+08:00",
        "last_heartbeat_ts": "2020-01-15T14:35:26.258495816+08:00",
        "uptime": "124h35m24.258495816s"
      }
    }
  ]
}

[tidb@dev10 ~]$

出现以上这种情况,会有那些原因,有什么好的处理方法

可以将监控时间拉长一些看下,是从什么时间点开始region 分布不均匀的吗?

看你 store 的信息,有两个 store 的磁盘比较小

多谢了

老师针对上面这个问题我有几个问题想了解一下:

  1. TiKV硬盘的大小不一样 对性能上有什么样的影响吗?
  2. 看监控指标,为什么硬盘小的两台 TiKV的 region 反而更高呢?
  3. 从目前监控来看,这种情况也与热点情况有什么不同吗?

关于 region 的分布可以看下官方文档的 PD 调度最佳实践

有热点的时候也可能会导致 region 分布不均衡,因为有 hot-region-balance 用于调度平衡几个节点之间的压力

老师 1 和 2 问题能麻烦回答一下吗?

  1. 理论上影响比较小,但是不同硬盘大小规格,导致 region 分布不均衡,可能会导致某些节点压力不均衡
  2. region 的调度是根据每个 store 的 score 进行调度的,影响 score 的因素在 pd 调度策略的文档中有介绍

谢谢老师:100: