You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过Beeline连接Kind环境中的HiveServer2求助

在Kind环境中部署HiveServer2后无法通过Beeline连接的问题

我在Kind环境中,基于apache/hive官方镜像,通过Kompose生成Helm Chart部署本地Hive,遇到以下问题:

HiveServer2 Deployment配置

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.34.0 (HEAD)
  labels:
    io.kompose.service: hiveserver2
  name: hiveserver2
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: hiveserver2
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.34.0 (HEAD)
      labels:
        io.kompose.service: hiveserver2
    spec:
      containers:
        - env:
            - name: HIVE_SERVER2_THRIFT_PORT
              value: "10000"
            - name: IS_RESUME
              value: "true"
            - name: SERVICE_NAME
              value: hiveserver2
            - name: SERVICE_OPTS
              value: -Xmx1G -Dhive.metastore.uris=thrift://hive-metastore:9083
          image: apache/hive:4.0.0
          name: hiveserver2
          ports:
            - containerPort: 10000
              protocol: TCP
            - containerPort: 10002
              protocol: TCP
          volumeMounts:
            - name: hive-config-volume
              mountPath: /opt/hive/conf/hive-site.xml
              subPath: hive-site.xml
      restartPolicy: Always
      volumes:
        - name: hive-config-volume
          configMap:
            name: hiveserver2-config
            items:
              - key: hive-site.xml
                path: hive-site.xml

ConfigMap配置

apiVersion: v1
kind: ConfigMap
metadata:
  name: hiveserver2-config
data:
  hive-site.xml: |
    <configuration>
      <property>
        <name>hive.metastore.uris</name>
        <value>thrift://hive-metastore:9083</value>
        <description>Thrift URI for the remote metastore.</description>
      </property>
      <property>
        <name>hive.server2.thrift.port</name>
        <value>10000</value>
      </property>
      <property>
        <name>hive.server2.thrift.bind.host</name>
        <value>0.0.0.0</value>
      </property>
      <property>
        <name>hive.server2.enable.doAs</name>
        <value>false</value>
      </property>
    </configuration>

连接报错信息

进入Pod后执行Beeline连接命令,报错如下:

hive@hiveserver2-5948c6f56-sd2qs:/opt/hive$ beeline -u "jdbc:hive2://localhost:10000" -n hive -p hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://localhost:10000
24/10/09 02:33:55 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status. Enable verbose error messages (--verbose=true) for more information.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
[WARN] Failed to create directory: /home/hive/.beeline
No such file or directory
hive@hiveserver2-5948c6f56-sd2qs:/opt/hive$

排查结果

执行netstat -tuln | grep 10000确认10000端口无进程监听。无论是使用Apache官方镜像还是自定义精简Docker镜像,均出现该问题。

内容的提问来源于stack exchange,提问作者Liam Pieri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 09:59:53