tidb-lightning使用local导入后查看集群模式异常

【TiDB 使用环境】生产环境
【TiDB 版本】5.2.3
【部署方式】阿里云机器部署
【操作系统/CPU 架构/芯片详情】 Centos7.8 X86
【机器部署详情】32C/128GB
【集群数据量】
【集群节点数】
【遇到的问题:问题现象及影响】

TiDB集群版本: 5.2.3
tidb-lightning版本: 5.2.3
过程:
1.使用dumpling导出库表数据
2.使用tidb-lightning的local模式导入新集群,由于导入比较慢于是取消了导入操作
3.想确认新集群的模式是否正常,处于"Import mode"还是"normal "模式

我记得以前直接执行以下命令就可以获取到集群当前模式
tidb-lightning-ctl --switch-mode=normal -tidb-host 172.29.1.65

但是现在需要提供更多的参数信息,比如

tidb-lightning-ctl --switch-mode=normal -tidb-host 172.29.1.65
tikv-importer.backend must not be empty!
tidb-lightning-ctl --switch-mode=normal -tidb-host 172.29.1.65 -backend tidb
invalid `tidb.port` setting
tidb-lightning-ctl --switch-mode=normal -tidb-host 172.29.1.65 -backend tidb -tidb-port 4000
Get "http:///pd/api/v1/stores": http: no Host in request URL

最终使用以下命令执行
tidb-lightning-ctl -fetch-mode -pd-urls=‘172.29.1.61:2379’ -backend tidb -tidb-port 4000
但是出现新的问题,返回

172.29.5.82:20161              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5683194 vs. 4194304)
172.29.5.81:20162              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6201988 vs. 4194304)
172.29.5.82:20163              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6164452 vs. 4194304)
172.29.5.81:20160              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6352484 vs. 4194304)
172.29.5.81:20163              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6519148 vs. 4194304)
172.29.5.81:20161              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6765976 vs. 4194304)
172.29.5.82:20162              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6999043 vs. 4194304)
172.29.5.82:20160              | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (7259536 vs. 4194304)

请问这个需要如何解决,或者还有其他方式可以查看集群当前的模式吗?

1 个赞

https://docs.pingcap.com/zh/tidb/stable/tidb-lightning-command-line-full/#tidb-lightning-ctl

2 个赞

grafana 监控中有个 lightning 的面板,然后有个 import/normal mode 的图

4 个赞

idb-lightning-ctl 默认 gRPC 消息大小限制为 4MB,而 PD 返回的 store 信息(含节点详情)超过该限制,导致请求被截断
设置环境变量(单位:字节,此处设为 10MB)
export GRPC_MAX_RECV_MSG_SIZE=10485760

再次执行命令
tidb-lightning-ctl -fetch-mode -pd-urls=‘172.29.1.61:2379’ -backend tidb -tidb-port 4000

1 个赞

grpc负载量大么?


此方法有效,Grafana可以看到导入模式

[root@xx1-newrpt-prod-tidb-65 src]# export GRPC_MAX_RECV_MSG_SIZE=10485760
[root@xx1-newrpt-prod-tidb-65 src]# tidb-lightning-ctl -fetch-mode -pd-urls=‘172.29.1.61:2379’ -backend tidb -tidb-port 4000
172.29.5.82:20161 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5740916 vs. 4194304)
172.29.5.82:20163 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6221835 vs. 4194304)
172.29.5.81:20160 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6411878 vs. 4194304)
172.29.5.81:20163 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6608841 vs. 4194304)
172.29.5.81:20161 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6831843 vs. 4194304)
172.29.5.82:20162 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (7120525 vs. 4194304)
172.29.5.82:20160 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (7378869 vs. 4194304)
172.29.5.81:20162 | Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6247542 vs. 4194304)
这个方式我试了下,设置 GRPC_MAX_RECV_MSG_SIZE=10485760 后,还是会报错

  • tidb-lightning-ctl 报错原因:gRPC 接收的消息大小超过了默认限制(4MB),TiKV 返回的集群状态信息体积较大,超出了默认阈值,导致通信失败。

版本太低了了,lightning 也更新了很多版本,建议使用其他的办法导入数据…


gRPC 最大支持 2GB,在 7.X 之后支持 gRPC 的分页传递后,就绕过了这个 Limit.

请参考!

7.x以后可以用import into, 这样就没grpc限制了

好的,目前先通过Grafana的监控来判断当前模式了

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