diff --git a/packaging/src/docker/conf/tez-site.xml.template b/packaging/src/docker/conf/tez-site.xml.template index a420137a97e2..c05a6f2d004e 100644 --- a/packaging/src/docker/conf/tez-site.xml.template +++ b/packaging/src/docker/conf/tez-site.xml.template @@ -33,6 +33,10 @@ tez.am.registry.namespace ${TEZ_AM_REGISTRY_NAMESPACE} + + tez.am.rpc.port + ${TEZ_AM_RPC_PORT} + tez.local.mode false diff --git a/packaging/src/docker/docker-compose.yml b/packaging/src/docker/docker-compose.yml index 0374255db654..40a4bdefdf55 100644 --- a/packaging/src/docker/docker-compose.yml +++ b/packaging/src/docker/docker-compose.yml @@ -32,11 +32,17 @@ services: - hive-db:/var/lib/postgresql networks: - hive + healthcheck: + test: ["CMD-SHELL", "pg_isready -U hive -d metastore_db"] + interval: 5s + timeout: 3s + retries: 30 metastore: image: apache/hive:${HIVE_VERSION} depends_on: - - postgres + postgres: + condition: service_healthy restart: unless-stopped container_name: metastore hostname: metastore @@ -67,11 +73,18 @@ services: - ./jars:/tmp/ext-jars:ro networks: - hive + healthcheck: + test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/9083'"] + interval: 5s + timeout: 5s + retries: 30 + start_period: 30s hiveserver2: image: apache/hive:${HIVE_VERSION} depends_on: - - metastore + metastore: + condition: service_healthy restart: unless-stopped container_name: hiveserver2 hostname: hiveserver2 @@ -125,6 +138,12 @@ services: - ./jars:/tmp/ext-jars:ro networks: - hive + healthcheck: + test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/10000'"] + interval: 10s + timeout: 10s + retries: 30 + start_period: 40s zookeeper: profiles: @@ -137,10 +156,17 @@ services: - '2181:2181' networks: - hive + environment: + ZOO_4LW_COMMANDS_WHITELIST: ruok volumes: - zookeeper_data:/data - zookeeper_datalog:/datalog - zookeeper_logs:/logs + healthcheck: + test: ["CMD-SHELL", "echo ruok | nc -w 2 127.0.0.1 2181 | grep imok"] + interval: 5s + timeout: 3s + retries: 30 tezam: profiles: @@ -149,7 +175,8 @@ services: container_name: tezam hostname: tezam depends_on: - - zookeeper + zookeeper: + condition: service_healthy restart: on-failure:3 environment: USER: hive @@ -157,6 +184,7 @@ services: TEZ_FRAMEWORK_MODE: STANDALONE_ZOOKEEPER TEZ_AM_ZOOKEEPER_QUORUM: zookeeper:2181 + TEZ_AM_RPC_PORT: '15100' # LLAP daemon discovery HIVE_ZOOKEEPER_QUORUM: zookeeper:2181 @@ -171,13 +199,20 @@ services: - scratch:/opt/hive/scratch networks: - hive + healthcheck: + test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/$${TEZ_AM_RPC_PORT}'"] + interval: 5s + timeout: 5s + retries: 30 + start_period: 20s llapdaemon: profiles: - llap image: apache/hive:${HIVE_VERSION} depends_on: - - zookeeper + zookeeper: + condition: service_healthy restart: unless-stopped environment: USER: hive @@ -205,6 +240,12 @@ services: - scratch:/opt/hive/scratch networks: - hive + healthcheck: + test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/15001'"] + interval: 5s + timeout: 5s + retries: 30 + start_period: 20s volumes: hive-db: diff --git a/packaging/src/docker/entrypoint.sh b/packaging/src/docker/entrypoint.sh index 5ec094edce31..a043ef095026 100644 --- a/packaging/src/docker/entrypoint.sh +++ b/packaging/src/docker/entrypoint.sh @@ -48,6 +48,7 @@ export HIVE_SERVER2_TEZ_USE_EXTERNAL_SESSIONS="${HIVE_SERVER2_TEZ_USE_EXTERNAL_S export TEZ_FRAMEWORK_MODE="${TEZ_FRAMEWORK_MODE:-}" export TEZ_AM_REGISTRY_NAMESPACE="${TEZ_AM_REGISTRY_NAMESPACE:-/tez_am/server}" export TEZ_AM_ZOOKEEPER_QUORUM="${TEZ_AM_ZOOKEEPER_QUORUM:-${HIVE_ZOOKEEPER_QUORUM}}" +export TEZ_AM_RPC_PORT="${TEZ_AM_RPC_PORT:-0}" envsubst < $HIVE_HOME/conf/core-site.xml.template > $HIVE_HOME/conf/core-site.xml envsubst < $HIVE_HOME/conf/hive-site.xml.template > $HIVE_HOME/conf/hive-site.xml diff --git a/packaging/src/docker/start-hive.sh b/packaging/src/docker/start-hive.sh index a76eea2cf31f..94ae369ee4f5 100755 --- a/packaging/src/docker/start-hive.sh +++ b/packaging/src/docker/start-hive.sh @@ -58,4 +58,6 @@ export COMPOSE_FILE="$COMPOSE_FILES" echo "Starting Hive cluster (mode=$HIVE_EXECUTION_MODE)" -docker compose $PROFILE up -d $SCALE +docker compose $PROFILE up -d --wait $SCALE + +echo "Hive cluster is ready."