TiDB 3.2 TiKV 缩容问题

根据官方文档操作具体内容如下

查看所有 KV运行情况
[tidb@test1 tidb-ansible]$ resources/bin/pd-ctl -u "http://172.160.180.46:2379" -d store
{
  "count": 3,
  "stores": [
    {
      "store": {
        "id": 1,
        "address": "172.160.180.46:20160",
        "version": "3.0.2",
        "state_name": "Up"
      },
      "status": {
        "capacity": "118 GiB",
        "available": "104 GiB",
        "leader_count": 560,
        "leader_weight": 1,
        "leader_score": 886,
        "leader_size": 886,
        "region_count": 1002,
        "region_weight": 1,
        "region_score": 1777,
        "region_size": 1777,
        "start_ts": "2019-08-15T13:17:44+08:00",
        "last_heartbeat_ts": "2019-08-20T09:33:59.402357092+08:00",
        "uptime": "116h16m15.402357092s"
      }
    },
    {
      "store": {
        "id": 4,
        "address": "172.160.180.47:20160",
        "version": "3.0.2",
        "state_name": "Up"
      },
      "status": {
        "capacity": "118 GiB",
        "available": "112 GiB",
        "leader_count": 442,
        "leader_weight": 1,
        "leader_score": 891,
        "leader_size": 891,
        "region_count": 1002,
        "region_weight": 1,
        "region_score": 1777,
        "region_size": 1777,
        "start_ts": "2019-08-15T13:17:44+08:00",
        "last_heartbeat_ts": "2019-08-20T09:33:59.234494228+08:00",
        "uptime": "116h16m15.234494228s"
      }
    },
    {
      "store": {
        "id": 5,
        "address": "172.160.180.48:20160",
        "state": 1,
        "version": "3.0.2",
        "state_name": "Up"
      },
      "status": {
        "leader_weight": 1,
        "region_count": 589,
        "region_weight": 1,
        "region_score": 1113,
        "region_size": 1113,
        "start_ts": "1970-01-01T08:00:00+08:00"
      }
    }
  ]
}

[tidb@test1 tidb-ansible]$
停止 id:5的KV
[tidb@test1 tidb-ansible]$ resources/bin/pd-ctl -u "http://172.160.180.46:2379" -d store delete 5
Success!
[tidb@test1 tidb-ansible]$
[tidb@test1 tidb-ansible]$ resources/bin/pd-ctl -u "http://172.160.180.46:2379" -d store 5
{
  "store": {
    "id": 5,
    "address": "172.160.180.48:20160",
    "state": 1,
    "version": "3.0.2",
    "state_name": "Offline"
  },
  "status": {
    "leader_weight": 1,
    "region_count": 589,
    "region_weight": 1,
    "region_score": 1113,
    "region_size": 1113,
    "start_ts": "1970-01-01T08:00:00+08:00"
  }
}

[tidb@test1 tidb-ansible]$

根据关文档提示如下 : 使用 Grafana 或者pd-ctl检查节点是否下线成功(下线需要一定时间,下线节点的状态变为 Tombstone 就说明下线成功了)

问题一:

预期效果:

下线后状态变为 Tombstone

实际情况:

下线后 过了10几个小时 一直是Offline

问题二:

“start_ts”: “1970-01-01T08:00:00+08:00” 为什么会一是 1970-01-01

tikv 默认最少 3 个节点,不能从 3 节点缩容,tikv 节点由 3 到 2 节点缩容,节点不会变成 tombstone 状态。此时需要将 下线节点的状态改成 up,如测试缩容步骤,建议先扩容至 4 节点,再进行缩容操作。

2赞

非常感谢你,我明白了.

如果觉得别人的回答有帮助,可以将答案标记为解决方案:white_check_mark:,这样可以帮助其他有同样问题的人快速找到答案~

好的谢谢指导

后面我们会优化一下 ansible,在这种情况下直接提示不能缩容。