Skip to content

Commit

Permalink
HIVE-27955: Missing Postgres driver when start services from Docker c…
Browse files Browse the repository at this point in the history
…ompose
  • Loading branch information
dengzhhu653 committed Dec 14, 2023
1 parent 7e5b5de commit 5a2e568
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packaging/src/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ For a quick start, launch the Metastore with Derby,
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 SERVICE_NAME=metastore \
--env DB_DRIVER=postgres \
docker run -d -p 9083:9083 --env SERVICE_NAME=metastore --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.5.1/postgresql-42.5.1.jar,target=/opt/hive/lib/postgres.jar \
--name metastore-standalone apache/hive:${HIVE_VERSION}
```
Expand Down Expand Up @@ -101,11 +101,12 @@ Launch the HiveServer2 with an embedded Metastore,

- HiveServer2, Metastore

To get a quick overview of both HiveServer2 and Metastore, you can run:
To get a quick overview of both HiveServer2 and Metastore, run:

```shell
cd packaging/src/docker
docker compose up -d
# This command will mount postgresql-42.5.1.jar from the maven local repository into the Metastore container
MAVEN_LOCAL_REPOSITORY=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout` docker compose up -d
```
Volumes are used to persist data generated by Hive inside Postgres and HiveServer2 containers,
- hive_db
Expand Down
3 changes: 3 additions & 0 deletions packaging/src/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ services:
- '9083:9083'
volumes:
- warehouse:/opt/hive/data/warehouse
- type: bind
source: ${MAVEN_LOCAL_REPOSITORY}/org/postgresql/postgresql/42.5.1/postgresql-42.5.1.jar
target: /opt/hive/lib/postgres.jar

hiveserver2:
image: apache/hive:${HIVE_VERSION}
Expand Down

0 comments on commit 5a2e568

Please sign in to comment.