You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by dk...@apache.org on 2025/06/13 09:23:26 UTC
(hive) branch master updated: HIVE-27275: Provide docker image for HMS (#5834)
This is an automated email from the ASF dual-hosted git repository.
dkuzmenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new e687059b5c2 HIVE-27275: Provide docker image for HMS (#5834)
e687059b5c2 is described below
commit e687059b5c2b3c728dd9e8e36efdf71ba8cee04a
Author: Denys Kuzmenko <dk...@apache.org>
AuthorDate: Fri Jun 13 11:23:19 2025 +0200
HIVE-27275: Provide docker image for HMS (#5834)
---
packaging/src/docker/README.md | 2 -
packaging/src/docker/conf/hive-site.xml | 2 +-
.../hadoop/hive/metastore/conf/MetastoreConf.java | 2 +-
.../metastore-rest-catalog/pom.xml | 1 +
standalone-metastore/metastore-server/pom.xml | 51 ++++++-
.../metastore-server/src/assembly/bin.xml | 4 +-
.../metastore-server/src/docker/Dockerfile | 85 ++++++++++++
.../metastore-server/src/docker/README.md | 151 +++++++++++++++++++++
.../metastore-server/src/docker/build.sh | 114 ++++++++++++++++
.../src/docker/conf/metastore-log4j2.properties | 53 ++++++++
.../src/docker/conf/metastore-site.xml | 44 ++----
.../metastore-server/src/docker/docker-compose.yml | 65 +++++++++
.../metastore-server/src/docker/entrypoint.sh | 55 ++++++++
13 files changed, 587 insertions(+), 42 deletions(-)
diff --git a/packaging/src/docker/README.md b/packaging/src/docker/README.md
index 5b1b5f0debb..bfed5ce40fc 100644
--- a/packaging/src/docker/README.md
+++ b/packaging/src/docker/README.md
@@ -29,8 +29,6 @@ Run Apache Hive inside docker container in pseudo-distributed mode, provide the
Here are the latest images:
- 4.0.0
-- 4.0.0-beta-1
-- 3.1.3
```shell
docker pull apache/hive:4.0.0
diff --git a/packaging/src/docker/conf/hive-site.xml b/packaging/src/docker/conf/hive-site.xml
index 155353a5331..8dc9b81064b 100644
--- a/packaging/src/docker/conf/hive-site.xml
+++ b/packaging/src/docker/conf/hive-site.xml
@@ -61,7 +61,7 @@
<value>/opt/hive/data/warehouse</value>
</property>
<property>
- <name>metastore.metastore.event.db.notification.api.auth</name>
+ <name>hive.metastore.event.db.notification.api.auth</name>
<value>false</value>
</property>
</configuration>
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
index 30aa5d2a6a8..5e44069bbe6 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
@@ -877,7 +877,7 @@ public enum ConfVars {
EVENT_DB_LISTENER_CLEAN_STARTUP_WAIT_INTERVAL("metastore.event.db.listener.clean.startup.wait.interval",
"hive.metastore.event.db.listener.clean.startup.wait.interval", 1, TimeUnit.DAYS,
"Wait interval post start of metastore after which the cleaner thread starts to work"),
- EVENT_DB_NOTIFICATION_API_AUTH("metastore.metastore.event.db.notification.api.auth",
+ EVENT_DB_NOTIFICATION_API_AUTH("metastore.event.db.notification.api.auth",
"hive.metastore.event.db.notification.api.auth", true,
"Should metastore do authorization against database notification related APIs such as get_next_notification.\n" +
"If set to true, then only the superusers in proxy settings have the permission"),
diff --git a/standalone-metastore/metastore-rest-catalog/pom.xml b/standalone-metastore/metastore-rest-catalog/pom.xml
index 3cb1cb9ccee..56c2b648ffb 100644
--- a/standalone-metastore/metastore-rest-catalog/pom.xml
+++ b/standalone-metastore/metastore-rest-catalog/pom.xml
@@ -33,6 +33,7 @@
<groupId>org.apache.hive</groupId>
<artifactId>hive-standalone-metastore-server</artifactId>
<version>${hive.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
diff --git a/standalone-metastore/metastore-server/pom.xml b/standalone-metastore/metastore-server/pom.xml
index bdd754044ee..1defc131949 100644
--- a/standalone-metastore/metastore-server/pom.xml
+++ b/standalone-metastore/metastore-server/pom.xml
@@ -28,12 +28,12 @@
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-standalone-metastore-common</artifactId>
- <version>4.1.0-SNAPSHOT</version>
+ <version>${hive.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-metastore</artifactId>
- <version>4.1.0-SNAPSHOT</version>
+ <version>${hive.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -491,6 +491,53 @@
</plugins>
</reporting>
</profile>
+ <profile>
+ <id>dist</id>
+ </profile>
+ <profile>
+ <id>docker</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <version>${hive.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-standalone-metastore-rest-catalog</artifactId>
+ <version>${hive.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-docker-image</id>
+ <phase>install</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>bash</executable>
+ <environmentVariables>
+ <SOURCE_DIR>${standalone.metastore.path.to.root}</SOURCE_DIR>
+ </environmentVariables>
+ <arguments>
+ <argument>src/docker/build.sh</argument>
+ <argument>-hadoop ${hadoop.version}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<!--
<profile>
<id>checkin</id>
diff --git a/standalone-metastore/metastore-server/src/assembly/bin.xml b/standalone-metastore/metastore-server/src/assembly/bin.xml
index 2196b513c48..967bc590c0c 100644
--- a/standalone-metastore/metastore-server/src/assembly/bin.xml
+++ b/standalone-metastore/metastore-server/src/assembly/bin.xml
@@ -18,9 +18,9 @@
-->
<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
diff --git a/standalone-metastore/metastore-server/src/docker/Dockerfile b/standalone-metastore/metastore-server/src/docker/Dockerfile
new file mode 100644
index 00000000000..74960fef577
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/Dockerfile
@@ -0,0 +1,85 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+ARG BUILD_ENV
+
+FROM ubuntu as unarchive
+ONBUILD COPY hadoop-*.tar.gz /opt
+ONBUILD COPY apache-hive-standalone-metastore-server-*-bin.tar.gz /opt
+
+FROM ubuntu as archive
+ARG HADOOP_VERSION
+ARG HIVE_VERSION
+ONBUILD RUN apt-get update && apt-get -y install wget
+ONBUILD RUN wget https://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz && \
+ wget https://archive.apache.org/dist/hive/hive-standalone-metastore-$HIVE_VERSION/apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz
+ONBUILD RUN mv hadoop-$HADOOP_VERSION.tar.gz /opt && \
+ mv apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz /opt
+
+FROM ubuntu as buildarchive
+ARG HADOOP_VERSION
+ARG HIVE_VERSION
+ONBUILD RUN apt-get update && apt-get -y install wget
+ONBUILD RUN wget https://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz
+ONBUILD COPY ./apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz /opt
+ONBUILD RUN mv hadoop-$HADOOP_VERSION.tar.gz /opt
+
+FROM ${BUILD_ENV} as env
+RUN echo ${BUILD_ENV}
+ARG HADOOP_VERSION
+ARG HIVE_VERSION
+
+RUN tar -xzvf /opt/hadoop-$HADOOP_VERSION.tar.gz -C /opt/ && \
+ rm -rf /opt/hadoop-$HADOOP_VERSION/share/doc/* && \
+ tar -xzvf /opt/apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz -C /opt/
+
+FROM eclipse-temurin:17.0.12_7-jre-ubi9-minimal AS run
+
+ARG HADOOP_VERSION
+ARG HIVE_VERSION
+COPY --from=env /opt/hadoop-$HADOOP_VERSION /opt/hadoop
+COPY --from=env /opt/apache-hive-metastore-$HIVE_VERSION-bin /opt/hive
+
+# Install dependencies
+RUN set -ex; \
+ microdnf update -y; \
+ microdnf -y install procps; \
+ rm -rf /var/lib/apt/lists/*
+
+# Set necessary environment variables.
+ENV HADOOP_HOME=/opt/hadoop \
+ HIVE_HOME=/opt/hive \
+ HIVE_VER=$HIVE_VERSION
+
+ENV PATH=$HIVE_HOME/bin:$HADOOP_HOME/bin:$PATH
+
+COPY entrypoint.sh /
+COPY conf $HIVE_HOME/conf
+RUN chmod +x /entrypoint.sh
+
+
+ARG UID=1000
+RUN useradd --no-create-home -s /sbin/nologin -c "" --uid $UID hive && \
+ chown hive /opt/hive && \
+ chown hive /opt/hadoop && \
+ chown hive /opt/hive/conf && \
+ mkdir -p /opt/hive/data/warehouse && \
+ chown hive /opt/hive/data/warehouse
+
+USER hive
+WORKDIR /opt/hive
+EXPOSE 9001 9083
+ENTRYPOINT ["sh", "-c", "/entrypoint.sh"]
diff --git a/standalone-metastore/metastore-server/src/docker/README.md b/standalone-metastore/metastore-server/src/docker/README.md
new file mode 100644
index 00000000000..33498797b32
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/README.md
@@ -0,0 +1,151 @@
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+### Introduction
+
+---
+Run Apache Hive Metastore inside docker container
+- Quick-start for Hive Metastore
+
+
+## Quickstart
+### STEP 1: Pull the image
+- Pull the image from DockerHub: https://hub.docker.com/r/apache/hive/tags.
+
+Here are the latest images:
+- standalone-metastore-4.0.0
+
+```shell
+docker pull apache/hive:standalone-metastore-4.0.0
+```
+### STEP 2: Export the Hive version
+```shell
+export HIVE_VERSION=4.0.0
+```
+
+### STEP 3: Launch Standalone Metastore backed by Derby,
+```shell
+docker run -d -p 9083:9083 --name metastore-standalone apache/hive:standalone-metastore-${HIVE_VERSION}
+```
+
+### Detailed Setup
+---
+#### Build image
+Apache Hive Metastore relies on Hadoop and some others to facilitate managing metadata of large datasets.
+The `build.sh` provides ways to build the image against specified version of the dependent, as well as build from source.
+
+##### Build from source
+```shell
+mvn clean install -DskipTests -Pdocker
+```
+##### Build with specified version
+There are some arguments to specify the component version:
+```shell
+-hadoop <hadoop version>
+-hive <hive version>
+```
+If the version is not provided, it will read the version from current `pom.xml`:
+`project.version`, `hadoop.version` for Hive and Hadoop respectively.
+
+For example, the following command uses Hive 4.0.0 and Hadoop `hadoop.version` to build the image,
+```shell
+./build.sh -hive 4.0.0
+```
+If the command does not specify the Hive version, it will use the local `apache-hive-standalone-metastore-${project.version}-bin.tar.gz`(will trigger a build if it doesn't exist),
+together with Hadoop 3.1.0 to build the image,
+```shell
+./build.sh -hadoop 3.1.0
+```
+After building successfully, we can get a Docker image named `apache/hive` tagged with `standalone-metastore` prefix and the provided Hive version.
+
+#### Run services
+
+Before going further, we should define the environment variable `HIVE_VERSION` first.
+For example, if `-hive 4.0.0` is specified to build the image,
+```shell
+export HIVE_VERSION=4.0.0
+```
+or assuming that you're relying on current `project.version` from pom.xml,
+```shell
+export HIVE_VERSION=$(mvn -f pom.xml -q help:evaluate -Dexpression=project.version -DforceStdout)
+```
+- Metastore
+
+For a quick start, launch the Metastore with Derby,
+ ```shell
+ docker run -d -p 9083:9083 --name metastore-standalone apache/hive:standalone-metastore-${HIVE_VERSION}
+ ```
+ Everything would be lost when the service is down. In order to save the Hive table's schema and data, start the container with an external Postgres and Volume to keep them,
+
+ ```shell
+ docker run -d -p 9083:9083 --env DB_DRIVER=postgres \
+ --env SERVICE_OPTS="-Djavax.jdo.option.ConnectionDriverName=org.postgresql.Driver -Djavax.jdo.option.ConnectionURL=jdbc:postgresql://postgres:5432/metastore_db -Djavax.jdo.option.ConnectionUserName=hive -Djavax.jdo.option.ConnectionPassword=password" \
+ --mount source=warehouse,target=/opt/hive/data/warehouse \
+ --mount type=bind,source=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout`/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar,target=/opt/hive/lib/postgres.jar \
+ --name metastore-standalone apache/hive:standalone-metastore-${HIVE_VERSION}
+ ```
+
+ If you want to use your own `hdfs-site.xml` for the service, you can provide the environment variable `HIVE_CUSTOM_CONF_DIR` for the command. For instance, put the custom configuration file under the directory `/opt/hive/conf`, then run,
+
+ ```shell
+ docker run -d -p 9083:9083 --env DB_DRIVER=postgres \
+ -v /opt/hive/conf:/hive_custom_conf --env HIVE_CUSTOM_CONF_DIR=/hive_custom_conf \
+ --mount type=bind,source=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout`/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar,target=/opt/hive/lib/postgres.jar \
+ --name metastore apache/hive:standalone-metastore-${HIVE_VERSION}
+ ```
+
+NOTE:
+
+1) For Hive releases before 4.0, if you want to upgrade the existing external Metastore schema to the target version,
+then add "--env SCHEMA_COMMAND=upgradeSchema" to the command.
+
+2) If the full Acid support (Compaction) is needed, use the Hive docker image to bring up the container.
+
+- Metastore with Postgres
+
+To spin up Metastore with a remote DB, there is a `docker-compose.yml` placed under `packaging/src/docker` for this purpose,
+specify the `POSTGRES_LOCAL_PATH` first:
+```shell
+export POSTGRES_LOCAL_PATH=your_local_path_to_postgres_driver
+```
+Example:
+```shell
+mvn dependency:copy -Dartifact="org.postgresql:postgresql:42.7.3" && \
+export POSTGRES_LOCAL_PATH=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout`/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar
+```
+If you don't install maven or have problem in resolving the postgres driver, you can always download this jar yourself,
+change the `POSTGRES_LOCAL_PATH` to the path of the downloaded jar.
+
+Then,
+```shell
+docker compose up -d
+```
+Metastore and Postgres services will be started as a consequence.
+
+Volumes:
+- hive_db
+
+ The volume persists the metadata of Hive tables inside Postgres container.
+- warehouse
+
+ The volume stores tables' files inside HiveServer2 container.
+
+To stop/remove them all,
+```shell
+docker compose down
+```
\ No newline at end of file
diff --git a/standalone-metastore/metastore-server/src/docker/build.sh b/standalone-metastore/metastore-server/src/docker/build.sh
new file mode 100755
index 00000000000..c4c790f5368
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/build.sh
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+set -eux
+HIVE_VERSION=
+HADOOP_VERSION=
+usage() {
+ cat <<EOF 1>&2
+Usage: $0 [-h] [-hadoop <Hadoop version>] [-hive <Hive version>] [-repo <Docker repo>]
+Build the Hive Docker image
+-help Display help
+-hadoop Build image with the specified Hadoop version
+-hive Build image with the specified Hive version
+-repo Docker repository
+EOF
+}
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h)
+ usage
+ exit 0
+ ;;
+ -hadoop)
+ shift
+ HADOOP_VERSION=$1
+ shift
+ ;;
+ -hive)
+ shift
+ HIVE_VERSION=$1
+ shift
+ ;;
+ -repo)
+ shift
+ REPO=$1
+ shift
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+
+SCRIPT_DIR=$(cd $(dirname $0); pwd)
+SOURCE_DIR=${SOURCE_DIR:-"$SCRIPT_DIR/../../.."}
+repo=${REPO:-apache}
+WORK_DIR="$(mktemp -d)"
+CACHE_DIR="$SCRIPT_DIR/../../cache"
+mkdir -p "$CACHE_DIR"
+HADOOP_VERSION=${HADOOP_VERSION:-$(mvn -f "$SOURCE_DIR/pom.xml" -q help:evaluate -Dexpression=hadoop.version -DforceStdout)}
+
+HADOOP_FILE_NAME="hadoop-$HADOOP_VERSION.tar.gz"
+HADOOP_URL=${HADOOP_URL:-"https://archive.apache.org/dist/hadoop/core/hadoop-$HADOOP_VERSION/$HADOOP_FILE_NAME"}
+if [ ! -f "$CACHE_DIR/$HADOOP_FILE_NAME" ]; then
+ echo "Downloading Hadoop from $HADOOP_URL..."
+ if ! curl --fail -L "$HADOOP_URL" -o "$CACHE_DIR/$HADOOP_FILE_NAME.tmp"; then
+ echo "Fail to download Hadoop, exiting...."
+ exit 1
+ fi
+ mv "$CACHE_DIR/$HADOOP_FILE_NAME.tmp" "$CACHE_DIR/$HADOOP_FILE_NAME"
+fi
+
+if [ -n "$HIVE_VERSION" ]; then
+ HIVE_FILE_NAME="apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz"
+ if [ ! -f "$CACHE_DIR/$HIVE_FILE_NAME" ]; then
+ HIVE_URL=${HIVE_URL:-"https://archive.apache.org/dist/hive/hive-standalone-metastore-server-$HIVE_VERSION/$HIVE_FILE_NAME"}
+ echo "Downloading Hive Metastore from $HIVE_URL..."
+ if ! curl --fail -L "$HIVE_URL" -o "$CACHE_DIR/$HIVE_FILE_NAME.tmp"; then
+ echo "Failed to download Hive Metastore, exiting..."
+ exit 1
+ fi
+ mv "$CACHE_DIR/$HIVE_FILE_NAME.tmp" "$CACHE_DIR/$HIVE_FILE_NAME"
+ fi
+ cp "$CACHE_DIR/$HIVE_FILE_NAME" "$WORK_DIR"
+else
+ HIVE_VERSION=$(mvn -f "$SOURCE_DIR/pom.xml" -q help:evaluate -Dexpression=project.version -DforceStdout)
+ HIVE_TAR="$SOURCE_DIR/metastore-server/target/apache-hive-standalone-metastore-server-$HIVE_VERSION-bin.tar.gz"
+ if ls "$HIVE_TAR" || mvn -f "$SOURCE_DIR/pom.xml" clean package -DskipTests; then
+ cp "$HIVE_TAR" "$WORK_DIR/"
+ else
+ echo "Failed to compile Hive Metastore project, exiting..."
+ exit 1
+ fi
+fi
+
+cp "$CACHE_DIR/hadoop-$HADOOP_VERSION.tar.gz" "$WORK_DIR/"
+cp -R "$SOURCE_DIR/metastore-server/src/docker/conf" "$WORK_DIR/"
+cp -R "$SOURCE_DIR/metastore-server/src/docker/entrypoint.sh" "$WORK_DIR/"
+cp "$SOURCE_DIR/metastore-server/src/docker/Dockerfile" "$WORK_DIR/"
+docker build \
+ "$WORK_DIR" \
+ -f "$WORK_DIR/Dockerfile" \
+ -t "$repo/hive:standalone-metastore-$HIVE_VERSION" \
+ --build-arg "BUILD_ENV=unarchive" \
+ --build-arg "HIVE_VERSION=$HIVE_VERSION" \
+ --build-arg "HADOOP_VERSION=$HADOOP_VERSION" \
+
+rm -r "${WORK_DIR}"
diff --git a/standalone-metastore/metastore-server/src/docker/conf/metastore-log4j2.properties b/standalone-metastore/metastore-server/src/docker/conf/metastore-log4j2.properties
new file mode 100644
index 00000000000..bb5483b056c
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/conf/metastore-log4j2.properties
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status = INFO
+name = MetastoreLog4j2
+packages = org.apache.hadoop.hive.metastore
+
+# list of properties
+property.hive.log.level = INFO
+property.hive.root.logger = stdout
+property.hive.perflogger.log.level = INFO
+
+# list of all appenders
+appenders = console
+
+# console appender
+appender.console.name = stdout
+appender.console.type = Console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %5p [%t] %c{2}: %m%n
+
+# list of all loggers
+loggers = DataNucleus, Datastore, JPOX, PerfLogger
+
+logger.DataNucleus.name = DataNucleus
+logger.DataNucleus.level = ERROR
+
+logger.Datastore.name = Datastore
+logger.Datastore.level = ERROR
+
+logger.JPOX.name = JPOX
+logger.JPOX.level = ERROR
+
+logger.PerfLogger.name = org.apache.hadoop.hive.ql.log.PerfLogger
+logger.PerfLogger.level = ${sys:hive.perflogger.log.level}
+
+# root logger
+rootLogger.level = ${sys:hive.log.level}
+rootLogger.appenderRefs = root
+rootLogger.appenderRef.root.ref = ${sys:hive.root.logger}
diff --git a/packaging/src/docker/conf/hive-site.xml b/standalone-metastore/metastore-server/src/docker/conf/metastore-site.xml
similarity index 52%
copy from packaging/src/docker/conf/hive-site.xml
copy to standalone-metastore/metastore-server/src/docker/conf/metastore-site.xml
index 155353a5331..0484b758f73 100644
--- a/packaging/src/docker/conf/hive-site.xml
+++ b/standalone-metastore/metastore-server/src/docker/conf/metastore-site.xml
@@ -17,51 +17,27 @@
-->
<configuration>
<property>
- <name>hive.server2.enable.doAs</name>
- <value>false</value>
+ <name>metastore.warehouse.dir</name>
+ <value>/opt/hive/data/warehouse</value>
</property>
<property>
- <name>hive.tez.exec.inplace.progress</name>
+ <name>metastore.compactor.initiator.on</name>
<value>false</value>
</property>
<property>
- <name>hive.tez.exec.print.summary</name>
- <value>true</value>
- </property>
- <property>
- <name>hive.exec.scratchdir</name>
- <value>/opt/hive/scratch_dir</value>
- </property>
- <property>
- <name>hive.user.install.directory</name>
- <value>/opt/hive/install_dir</value>
- </property>
- <property>
- <name>tez.runtime.optimize.local.fetch</name>
- <value>true</value>
- </property>
- <property>
- <name>hive.exec.submit.local.task.via.child</name>
+ <name>metastore.compactor.cleaner.on</name>
<value>false</value>
</property>
<property>
- <name>hive.compactor.worker.threads</name>
- <value>1</value>
- </property>
- <property>
- <name>mapreduce.framework.name</name>
- <value>local</value>
- </property>
- <property>
- <name>tez.local.mode</name>
- <value>true</value>
+ <name>metastore.event.db.notification.api.auth</name>
+ <value>false</value>
</property>
<property>
- <name>hive.metastore.warehouse.dir</name>
- <value>/opt/hive/data/warehouse</value>
+ <name>hive.metastore.iceberg.catalog.servlet.port</name>
+ <value>9001</value>
</property>
<property>
- <name>metastore.metastore.event.db.notification.api.auth</name>
- <value>false</value>
+ <name>hive.metastore.iceberg.catalog.servlet.auth</name>
+ <value>simple</value>
</property>
</configuration>
diff --git a/standalone-metastore/metastore-server/src/docker/docker-compose.yml b/standalone-metastore/metastore-server/src/docker/docker-compose.yml
new file mode 100644
index 00000000000..70611af1175
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/docker-compose.yml
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version: '3.9'
+services:
+ postgres:
+ image: postgres
+ restart: unless-stopped
+ container_name: postgres
+ hostname: postgres
+ environment:
+ POSTGRES_DB: 'metastore_db'
+ POSTGRES_USER: 'hive'
+ POSTGRES_PASSWORD: 'password'
+ ports:
+ - '5432:5432'
+ volumes:
+ - hive-db:/var/lib/postgresql
+ networks:
+ - hive
+
+ metastore:
+ image: apache/hive:standalone-metastore-${HIVE_VERSION}
+ depends_on:
+ - postgres
+ restart: unless-stopped
+ container_name: metastore
+ hostname: metastore
+ environment:
+ DB_DRIVER: postgres
+ SERVICE_NAME: 'metastore'
+ SERVICE_OPTS: '-Xmx1G -Djavax.jdo.option.ConnectionDriverName=org.postgresql.Driver
+ -Djavax.jdo.option.ConnectionURL=jdbc:postgresql://postgres:5432/metastore_db
+ -Djavax.jdo.option.ConnectionUserName=hive
+ -Djavax.jdo.option.ConnectionPassword=password'
+ ports:
+ - '9083:9083'
+ volumes:
+ - warehouse:/opt/hive/data/warehouse
+ - type: bind
+ source: ${POSTGRES_LOCAL_PATH}
+ target: /opt/hive/lib/postgres.jar
+ networks:
+ - hive
+
+volumes:
+ hive-db:
+ warehouse:
+
+networks:
+ hive:
+ name: hive
diff --git a/standalone-metastore/metastore-server/src/docker/entrypoint.sh b/standalone-metastore/metastore-server/src/docker/entrypoint.sh
new file mode 100644
index 00000000000..6ce038904d4
--- /dev/null
+++ b/standalone-metastore/metastore-server/src/docker/entrypoint.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -x
+
+: "${DB_DRIVER:=derby}"
+
+SKIP_SCHEMA_INIT="${IS_RESUME:-false}"
+[[ $VERBOSE = "true" ]] && VERBOSE_MODE="--verbose" || VERBOSE_MODE=""
+
+function initialize_hive {
+ COMMAND="-initOrUpgradeSchema"
+ if [ "$(echo "$HIVE_VER" | cut -d '.' -f1)" -lt "4" ]; then
+ COMMAND="-${SCHEMA_COMMAND:-initSchema}"
+ fi
+ "$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$COMMAND" "$VERBOSE_MODE"
+ if [ $? -eq 0 ]; then
+ echo "Initialized Hive Metastore Server schema successfully.."
+ else
+ echo "Hive Metastore Server schema initialization failed!"
+ exit 1
+ fi
+}
+
+export HIVE_CONF_DIR=$HIVE_HOME/conf
+if [ -d "${HIVE_CUSTOM_CONF_DIR:-}" ]; then
+ find "${HIVE_CUSTOM_CONF_DIR}" -type f -exec \
+ ln -sfn {} "${HIVE_CONF_DIR}"/ \;
+ export HADOOP_CONF_DIR=$HIVE_CONF_DIR
+fi
+
+export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Xmx1G $SERVICE_OPTS"
+if [[ "${SKIP_SCHEMA_INIT}" == "false" ]]; then
+ # handles schema initialization
+ initialize_hive
+fi
+
+export METASTORE_PORT=${METASTORE_PORT:-9083}
+exec "$HIVE_HOME/bin/start-metastore"