diff --git a/packaging/src/docker/README.md b/packaging/src/docker/README.md index 5ed8cb1e3ee2..01ce5a116fc6 100644 --- a/packaging/src/docker/README.md +++ b/packaging/src/docker/README.md @@ -210,3 +210,14 @@ docker compose down select count(distinct a) from hive_example; select sum(b) from hive_example; ``` + +#### Hive Schema Tool + +`Hive Schema Tool` is located in the Docker Image at `/opt/hive/bin/schematool`. +Possible use cases are as follows, + +```shell +docker run -d --env SERVICE_NAME=hiveserver2 --name hive4 apache/hive:${HIVE_VERSION} +docker exec -it hive4 /bin/bash +/opt/hive/bin/schematool -info -dbType hive -metaDbType derby -url jdbc:hive2://localhost:10000/default +``` diff --git a/packaging/src/docker/entrypoint.sh b/packaging/src/docker/entrypoint.sh index f22652c2afb6..0e17a9e870f1 100644 --- a/packaging/src/docker/entrypoint.sh +++ b/packaging/src/docker/entrypoint.sh @@ -31,11 +31,19 @@ function initialize_hive { fi $HIVE_HOME/bin/schematool -dbType $DB_DRIVER $COMMAND $VERBOSE_MODE if [ $? -eq 0 ]; then - echo "Initialized schema successfully.." + echo "Initialized Hive Metastore Server schema successfully.." else - echo "Schema initialization failed!" + echo "Hive Metastore Server schema initialization failed!" exit 1 fi + if [[ "${SERVICE_NAME:-}" == "hiveserver2" ]]; then + $HIVE_HOME/bin/schematool $COMMAND -dbType hive -metaDbType $DB_DRIVER -url jdbc:hive2://localhost:10000/default $VERBOSE_MODE + if [ $? -ne 0 ]; then + echo "Hive-Server 2 schema initialization failed!" + exit 1 + fi + echo "Initialized Hive-Server 2 schema successfully.." + fi } export HIVE_CONF_DIR=$HIVE_HOME/conf