集群enable_tls后lightning如何配置?

【 TiDB 使用环境】
v4.0.13

【概述】
lightning配置如下:

pd-addr = "https://192.168.237.141:2379"
tls = 'cluster'

[security]
#
# # CA 的公钥证书。设置为空字符串可禁用 SQL 的 TLS。
ca-path = "/data/tidb-deploy/tidb-4000/tls/ca.crt"
#
# # 该服务的公钥证书。默认为 `security.cert-path` 的副本
cert-path = "/data/tidb-deploy/tidb-4000/tls/tidb.crt"
#
# # 此服务的私钥。默认为 `security.key-path` 的副本
key-path = "/data/tidb-deploy/tidb-4000/tls/tidb.pem"

【问题】
检查 pd地址无误, tidb可以正确连接,但报错如下:

[root@localhost bin]# ./tidb-lightning -config tidb-lightning.toml
Verbose debug logs will be written to tidb-lightning.log

tidb lightning encountered error:  build local backend failed: construct pd client failed: pd address (https://192.168.237.141:2379) not available, please check network: [BR:PD:ErrPDUpdateFailed]failed to update PD

请问在 TLS 打开的情况下如何正确配置 lightning ?

1 个赞

@听风吹雨 帮忙看看这个问题。

1、测试下去掉证书验证的情况下是否可以正常连接
2、另外这里的证书是否有格式的问题,你对比下:https://docs.pingcap.com/zh/tidb/stable/tidb-lightning-configuration/#tidb-lightning-任务配置

1 个赞

global:
user: tidb
ssh_port: 22
ssh_type: builtin
enable_tls: true

enable_tls: true 这样开启集群 TLS

1、去掉证书不能连接;
2、证书格式没有问题,我对TLS做了一些测试: https://pingcap.feishu.cn/docs/doccns7PV3h1PHNxDraM3A2eAnd#FC9KGQ
; lightning 证书填tidb组件证书,还是PD组件证书?

谢谢各位老师,正确配置如下:

[lightning]

level = "info"

file = "tidb-lightning.log"

[tikv-importer]

backend = "local"

sorted-kv-dir = "/data/lightning_data/"

[mydumper]

data-source-dir = "/tmp/test/"

filter = ['*.*', '!mysql.*', '!sys.*', '!INFORMATION_SCHEMA.*', '!PERFORMANCE_SCHEMA.*', '!METRICS_SCHEMA.*', '!INSPECTION_SCHEMA.*']

[tidb]

host = "192.168.237.141"

port = 4000

user = "root"

password = ""

status-port = 10080

pd-addr = "192.168.237.141:2379"

tls = "preferred"

[security]

ca-path = "/data/tidb-deploy/pd-2379/tls/ca.crt"

cert-path = "/data/tidb-deploy/pd-2379/tls/pd.crt"

key-path = "/data/tidb-deploy/pd-2379/tls/pd.pem"

[tidb.security]

cert-path = "/data/certs/server-cert.pem"

key-path = "/data/certs/server-key.pem"

1 个赞

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