无法通过beeline访问hiveserver2

问题描述 投票:0回答:1

我正在尝试通过 apache/hive 的 Kompose 生成的 helm 图表的一部分在 Kind 中本地运行 hive。

我的

hiveserver2-deployment.yaml

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
监听端口。

虽然这是基于 apache 图像的。我尝试制作自己的精简版 Docker 镜像,但仍然达到了这一点。

docker hive beeline helmfile
1个回答
0
投票

如快速入门指南中所述 [1]:https://hive.apache.org/developement/quickstart/

我相信程序的主机名是 hiveserver2 而不是 localhost,我已经在 docker 中启动并运行了它。

© www.soinside.com 2019 - 2024. All rights reserved.