Clen Moras
06/09/2023, 2:30 PMClen Moras
06/09/2023, 2:36 PMvolumeMounts:
- name: flink-config-volume
mountPath: /opt/flink/conf
- name: hive-conf-vol
mountPath: /opt/flink/hive-conf/core-site.xml
subPath: core-site.xml
- name: hive-conf-vol
mountPath: /opt/flink/hive-conf/metastore-site.xml
subPath: metastore-site.xml
- name: hive-conf-vol
mountPath: /opt/flink/hive-conf/hive-site.xml
subPath: hive-site.xml
----
volumes:
- name: flink-config-volume
configMap:
name: flink-config
items:
- key: flink-conf.yaml
path: flink-conf.yaml
- key: log4j-console.properties
path: log4j-console.properties
- name: hive-conf-vol
configMap:
name: flink-hive-configmap
added the following in flink-config
security.kerberos.fetch.delegation-token: false
env.java.opts: "-Dflink.catalog.configuration-file=/opt/flink/hive-conf/flink-hive-conf.yaml"
my hive-related config
cat flink-hive-config.yaml
catalogs:
- name: myhive
type: hive
hive-version: 3.0.0
hive-conf-dir: /opt/flink/hive-conf
hive-site.xml that i have added the flink-cluster
<configuration>
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value><thrift://metastore.flink-hive-test.svc.cluster.local:9083></value>
</property>
</configuration>
Dockerfile that i m using for flink standalone cluster
FROM flink:1.16.2@sha256:d836ec8670b74308df5300e48da1905d09c075cbdcf64ef77af3cc28593fceb9
WORKDIR /opt/flink
# Create the hive-conf directory
RUN mkdir -p /opt/flink/hive-conf
COPY flink-hive-config.yaml /opt/flink/hive-conf
RUN ls conf/
# Move flink-table-planner JAR to lib directory
RUN mv $FLINK_HOME/opt/flink-table-planner_2.12-1.16.2.jar $FLINK_HOME/lib/flink-table-planner_2.12-1.16.2.jar
# Move flink-table-planner-loader JAR out of lib directory
RUN mv $FLINK_HOME/lib/flink-table-planner-loader-1.16.2.jar $FLINK_HOME/opt/flink-table-planner-loader-1.16.2.jar
# Download and include Hive dependencies
RUN wget -O $FLINK_HOME/lib/flink-connector-hive_2.12-1.16.2.jar <https://repo1.maven.org/maven2/org/apache/flink/flink-connector-hive_2.12/1.16.2/flink-connector-hive_2.12-1.16.2.jar> && \
wget -O $FLINK_HOME/lib/hive-exec-3.1.0.jar <https://repo1.maven.org/maven2/org/apache/hive/hive-exec/3.1.0/hive-exec-3.1.0.jar> && \
wget -O $FLINK_HOME/lib/libfb303-0.9.3.jar <https://repo1.maven.org/maven2/org/apache/thrift/libfb303/0.9.3/libfb303-0.9.3.jar> && \
wget -O $FLINK_HOME/lib/antlr-runtime-3.5.2.jar <https://repo.maven.apache.org/maven2/org/antlr/antlr-runtime/3.5.2/antlr-runtime-3.5.2.jar> && \
wget -O $FLINK_HOME/lib/flink-sql-connector-hive-3.1.2_2.12-1.16.2.jar <https://repo.maven.apache.org/maven2/org/apache/flink/flink-sql-connector-hive-3.1.2_2.12/1.16.2/flink-sql-connector-hive-3.1.2_2.12-1.16.2.jar>
RUN wget -O $FLINK_HOME/lib/hadoop-common-3.2.0.jar <https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-common/3.2.0/hadoop-common-3.2.0.jar>
my running hive-metastore
FROM openjdk:8-slim
ARG HADOOP_VERSION=3.2.0
RUN apt-get update && apt-get install -y curl --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Download and extract the Hadoop binary package.
RUN curl <https://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz> \
| tar xvz -C /opt/ \
&& ln -s /opt/hadoop-$HADOOP_VERSION /opt/hadoop \
&& rm -r /opt/hadoop/share/doc
# Add S3a jars to the classpath using this hack.
RUN ln -s /opt/hadoop/share/hadoop/tools/lib/hadoop-aws* /opt/hadoop/share/hadoop/common/lib/ && \
ln -s /opt/hadoop/share/hadoop/tools/lib/aws-java-sdk* /opt/hadoop/share/hadoop/common/lib/
# Set necessary environment variables.
ENV HADOOP_HOME="/opt/hadoop"
ENV PATH="/opt/spark/bin:/opt/hadoop/bin:${PATH}"
# Download and install the standalone metastore binary.
RUN curl <http://apache.uvigo.es/hive/hive-standalone-metastore-3.0.0/hive-standalone-metastore-3.0.0-bin.tar.gz> \
| tar xvz -C /opt/ \
&& ln -s /opt/apache-hive-metastore-3.0.0-bin /opt/hive-metastore
# Download and install the mysql connector.
RUN curl -L <https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz> \
| tar xvz -C /opt/ \
&& ln -s /opt/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47.jar /opt/hadoop/share/hadoop/common/lib/ \
&& ln -s /opt/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47.jar /opt/hive-metastore/lib/
this metastore is backed by mariadb.Clen Moras
06/09/2023, 2:37 PMOscar Perez
06/09/2023, 3:08 PMOscar Perez
06/09/2023, 3:08 PMClen Moras
06/09/2023, 3:15 PMClen Moras
06/09/2023, 3:21 PM