dockerhivebeelinehelmfile

Unable to access hiveserver2 via beeline


I am trying to run hive locally in Kind via a part of a helm chart generated from Kompose of apache/hive.

My 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

And my 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>

When I exec into the pod I'm unable to connect to the server with 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$

It's clear nothing is listening on the port via netstat -tuln | grep 10000.

While this is based off of the apache image. I have tried to make my own stripped down Docker image and still arrive at this point.


Solution

  • As mentioned here in the quickstart guide [1]: https://hive.apache.org/developement/quickstart/

    I believe the host name of the program is hiveserver2 instead of localhost, I have got it up and running in docker.