我试图从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应用程序在我创建外部配置单元表的地方崩溃
我在Kubernetes集群中运行Hive-metastore以及Spark应用程序(使用Spark K8s操作符)。我使用telnet (节点ip:服务节点端口)检查了集群外的Hive-metastore服务的可访问性,并将服务卷曲到集群内,该服务似乎是可访问的。此错误的原因可能是什么?
这是Spark应用程序中配置单元-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()配置单元-转储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更新:当我尝试卷曲hive-metastore :9083时,服务可以访问,但它返回一个空响应,这意味着可能是hive-metastore K8s定义有问题
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: hive-metastore:9083
> Accept: */*发布于 2019-02-26 01:37:09
当集群中的hive jar版本与Spark使用的hive jar版本之间存在差异(通常与您使用的Spark版本一致)时,就会出现此错误。您需要确定集群中使用的hive jar的版本,并将这些jar添加到您的Spark镜像中。然后,您可以通过向您的SparkSession添加以下配置,使您的SparkSession使用这些兼容的配置单元jars:
.conf("spark.sql.hive.metastore.version", "<your hive metastore version>")
.conf("spark.sql.hive.metastore.version", "<your hive version>")
.conf("spark.sql.hive.metastore.jars", "<uri of all the correct hive jars>")https://stackoverflow.com/questions/54810240
复制相似问题