我正在尝试从 Spark 应用程序连接到 Hive-metastore,但每次它都卡在尝试连接并因超时而崩溃:
INFO metastore:376 - Trying to connect to metastore with URI thrift://hive-metastore:9083
WARN metastore:444 - set_ugi() not successful, Likely cause: new client talking to old server. Continuing without it.
org.apache.thrift.transport.TTransportException: java.net.SocketTimeoutException: Read timed out
应用程序在我创建外部 Hive 表的行上崩溃
我在 Kubernetes 集群中运行 Hive-metastore 以及 Spark 应用程序(使用 Spark K8s 运算符)。我使用 telnet(节点 ip:服务节点端口)检查了集群外部 Hive-metastore 服务的可访问性,并在集群内部卷曲了服务,该服务似乎是可评估的。这个错误的原因可能是什么?
这是 Spark 应用程序中 Hive-metastore uri 的配置
val sparkSession = SparkSession
.builder()
.config(sparkConf)
.config("hive.metastore.uris", "thrift://hive-metastore:9083")
.config("hive.exec.dynamic.partition", "true")
.config("hive.exec.dynamic.partition.mode", "nonstrict")
.enableHiveSupport()
.getOrCreate()
Hive-metastore yaml 配置如下所示:
apiVersion: v1
kind: Service
metadata:
name: hive-metastore-np
spec:
selector:
app: hive-metastore
ports:
- protocol: TCP
targetPort: 9083
port: 9083
nodePort: 32083
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hive-metastore
spec:
replicas: 1
selector:
matchLabels:
app: hive-metastore
template:
metadata:
labels:
app: hive-metastore
spec:
containers:
- name: hive-metastore
image: mozdata/docker-hive-metastore:1.2.1
imagePullPolicy: Always
env:
- name: DB_URI
value: postgresql
- name: DB_USER
value: hive
- name: DB_PASSWORD
value: hive-password
- name: CORE_CONF_fs_defaultFS
value: hdfs://hdfs-namenode:8020
ports:
- containerPort: 9083
更新:当我尝试 curl hive-metastore:9083 时,该服务是可访问的,但它返回一个空响应,这意味着 hive-metastore K8s 定义可能存在问题
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: hive-metastore:9083
> Accept: */*