Skip to content

Commit

Permalink
HIVE-27969: Add verbose logging for schema initialisation and metasto…
Browse files Browse the repository at this point in the history
…re service (apache#4972) (Akshat Mathur, reviewed by Zsolt Miskolczi, Zhihua Deng, Attila Turoczy, Kokila N)
  • Loading branch information
akshat0395 authored Jan 4, 2024
1 parent 96d46dc commit 1f2495e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packaging/src/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@ Launch the HiveServer2 with an embedded Metastore,
docker run -d -p 10000:10000 -p 10002:10002 --env SERVICE_NAME=hiveserver2 \
--env SERVICE_OPTS="-Dhive.metastore.uris=thrift://metastore:9083" \
--env IS_RESUME="true" \
--env VERBOSE="true" \
--name hiveserver2-standalone apache/hive:${HIVE_VERSION}
```

NOTE:

To skip schematool initialisation or upgrade for metastore use `IS_RESUME="true"`, and for verbose logging set `VERBOSE="true"`


To save the data between container restarts, you can start the HiveServer2 with a Volume,

```shell
docker run -d -p 10000:10000 -p 10002:10002 --env SERVICE_NAME=hiveserver2 \
--env SERVICE_OPTS="-Dhive.metastore.uris=thrift://metastore:9083" \
Expand Down
7 changes: 4 additions & 3 deletions packaging/src/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ 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
$HIVE_HOME/bin/schematool -dbType $DB_DRIVER $COMMAND $VERBOSE_MODE
if [ $? -eq 0 ]; then
echo "Initialized schema successfully.."
else
Expand All @@ -53,8 +54,8 @@ fi

if [ "${SERVICE_NAME}" == "hiveserver2" ]; then
export HADOOP_CLASSPATH=$TEZ_HOME/*:$TEZ_HOME/lib/*:$HADOOP_CLASSPATH
exec $HIVE_HOME/bin/hive --skiphadoopversion --skiphbasecp --service $SERVICE_NAME
elif [ "${SERVICE_NAME}" == "metastore" ]; then
export METASTORE_PORT=${METASTORE_PORT:-9083}
exec $HIVE_HOME/bin/hive --skiphadoopversion --skiphbasecp $VERBOSE_MODE --service $SERVICE_NAME
fi

exec $HIVE_HOME/bin/hive --skiphadoopversion --skiphbasecp --service $SERVICE_NAME

0 comments on commit 1f2495e

Please sign in to comment.