This is an automated email from the ASF dual-hosted git repository. dengzh pushed a commit to branch revert-9-docker-driver in repository https://gitbox.apache.org/repos/asf/hive-site.git
commit b13aa00d178b55232ffe9deaf4037d905e35f35d Author: dengzh <[email protected]> AuthorDate: Fri Jan 19 13:28:31 2024 +0800 Revert "Bind driver when start Metastore" --- content/Developement/quickStart.md | 49 ++++++++++++-------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/content/Developement/quickStart.md b/content/Developement/quickStart.md index 9766805..6a21e9a 100644 --- a/content/Developement/quickStart.md +++ b/content/Developement/quickStart.md @@ -102,23 +102,20 @@ 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 \ - --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} + 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 \ + --name metastore-standalone apache/hive:${HIVE_VERSION} ``` -If you want to use your own `hdfs-site.xml` or `yarn-site.xml` for the service, you can provide the environment variable `HIVE_CUSTOM_CONF_DIR` for the command. For instance, put the custom configuration file under the directory `/opt/hive/conf`, then, + +If you want to use your own `hdfs-site.xml` or `yarn-site.xml` for the service, you can provide the environment variable `HIVE_CUSTOM_CONF_DIR` for the command. For instance, put the custom configuration file under the directory `/opt/hive/conf`, then run, ```shell - docker run -d -p 9083:9083 --env SERVICE_NAME=metastore --env DB_DRIVER=postgres \ - -v /opt/hive/conf:/hive_custom_conf --env HIVE_CUSTOM_CONF_DIR=/hive_custom_conf \ - --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 apache/hive:${HIVE_VERSION} + docker run -d -p 9083:9083 --env SERVICE_NAME=metastore \ + --env DB_DRIVER=postgres -v /opt/hive/conf:/hive_custom_conf --env HIVE_CUSTOM_CONF_DIR=/hive_custom_conf \ + --name metastore apache/hive:${HIVE_VERSION} ``` -For Hive releases before 4.0, if you want to upgrade the existing external Metastore schema to the target version, then add --env SCHEMA_COMMAND=upgradeSchema to the command. -To skip schematool initialisation or upgrade for metastore use --env IS_RESUME="true", and for verbose logging set --env VERBOSE="true". - ` ` ##### **- HiveServer2** @@ -144,34 +141,18 @@ To save the data between container restarts, you can start the HiveServer2 with ` ` ##### **- HiveServer2, Metastore** -To get a quick overview of both HiveServer2 and Metastore, there is a `docker-compose.yml` placed under `packaging/src/docker` for this purpose, -specify the `POSTGRES_LOCAL_PATH` first: -```shell -export POSTGRES_LOCAL_PATH=your_local_path_to_postgres_driver -``` -Example: -```shell -mvn dependency:copy -Dartifact="org.postgresql:postgresql:42.5.1" && \ -export POSTGRES_LOCAL_PATH=`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout`/org/postgresql/postgresql/42.5.1/postgresql-42.5.1.jar -``` -If you don't install maven or have problem in resolving the postgres driver, you can always download this jar yourself, -change the `POSTGRES_LOCAL_PATH` to the path of the downloaded jar. +To get a quick overview of both HiveServer2 and Metastore, you can run: -Then, ```shell -docker compose up -d -``` -HiveServer2, Metastore and Postgres services will be started as a consequence. Volumes are used to persist data generated by Hive inside Postgres and HiveServer2 containers: + cd packaging/src/docker + docker compose up -d + ``` +Volumes are used to persist data generated by Hive inside Postgres and HiveServer2 containers: - hive_db - The volume persists the metadata of Hive tables inside Postgres container. - warehouse - The volume stores tables' files inside HiveServer2 container. -To stop/remove them all, -```shell -docker compose down -``` - ### Usage ---
