Skip to content

Commit

Permalink
HIVE-28437: Support for initializing system database of Hive-Server 2…
Browse files Browse the repository at this point in the history
… for Docker Image
  • Loading branch information
linghengqian committed Feb 2, 2025
1 parent dee6546 commit 39117e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 11 additions & 0 deletions packaging/src/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
12 changes: 10 additions & 2 deletions packaging/src/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39117e5

Please sign in to comment.