dengzhhu653 commented on code in PR #5834:
URL: https://github.com/apache/hive/pull/5834#discussion_r2122486533


##########
standalone-metastore/metastore-server/src/docker/README.md:
##########
@@ -0,0 +1,117 @@
+<!--
+{% 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-metastore/tags. 
+
+Here are the latest images:
+- 4.0.0
+- 4.0.0-beta-1
+- 3.1.3
+
+```shell
+docker pull apache/hive-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-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 package -pl metastore-server -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-metastore` by default, the image is tagged by 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:${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:${HIVE_VERSION}

Review Comment:
   apache/hive -> apache/hive-metastore



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to