K8S 部署Tidb成功后,spark连接PD报错

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:K8S 部署Tidb成功后,spark连接PD报错
  • 【问题描述】:
    Caused by: java.net.UnknownHostException: tidb-dev-pd-2.tidb-dev-pd-peer.tidb.svc: Name or service not known

若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

检查下主机名是否有设置,可以参考该案例 Spark安装中遇到的JAVA_HOME is not set和Name or service not known错误_spark java_home is not set-CSDN博客

请问 Spark 是在 K8S 集群内还是部署在 K8S 集群外。如果是在集群外部署K8S,可能会因为拿到了 K8S 内的主机名从而导致链接失败。

Spark是部署在CDH 上的,但是CDH集群和K8S集群是在相同服务器上混合部署的。

Spark 是部署在 K8S 集群外部的,需要将服务端口暴露出去,具体参考文档
https://pingcap.com/docs-cn/stable/tidb-in-kubernetes/deploy/access-tidb/#访问-kubernetes-上的-tidb-集群

官方不支持k8s集群外的tisprk访问tidb哦.

您好,请问您这里还有问题吗?

Hi, I have the same problem, I have tidb on EKS (AWS) and spark in EMR, but when I open PD port using loadbalancer or nodeport, spark cannot reach, I got this error :
[Channel<7>: (tidb-pd-0.tidb-pd-peer.tidb-cluster.svc:2379)] Failed to resolve name. status=Status{code=UNAVAILABLE, description=Unable to resolve host tidb-pd-0.tidb-pd-peer.tidb-cluster.svc, cause=java.lang.RuntimeException: java.net.UnknownHostException: tidb-pd-0.tidb-pd-peer.tidb-cluster.svc: Name or service not known

Where did you deploy your spark?
If you want to access PD through NodePort, maybe you should access PD through <NodeIP>:<NodePort>.

Hi, thanks for your response, I’ve already expose pd using NodePort and get the same error. I have spark outside (spark in AWS EMR ) of kubernetes cluster running tidb v4.

My question is tispark connector support connect to tidb operator (kubernetes) from spark cluster outside of kubernetes? This thread has the same error. TiSpark 中 pd peer UNAVAILABLE: Unable to resolve host

Whatever information you have, i’ll be thankful.

Thanks in advance.

Regrats from latam.

@MichaelMt66
Can you deploy TiSpark in the same kubernetes cluster with PD?
https://docs.pingcap.com/tidb-in-kubernetes/stable/faq#does-tidb-operator-support-tispark