diff --git a/packaging/src/docker/docker-compose.yml b/packaging/src/docker/docker-compose.yml index 0374255db654..24dcae224705 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: @@ -141,6 +160,11 @@ services: - zookeeper_data:/data - zookeeper_datalog:/datalog - zookeeper_logs:/logs + healthcheck: + test: ["CMD-SHELL", "bash -c 'echo ruok > /dev/tcp/localhost/2181'"] + interval: 5s + timeout: 3s + retries: 30 tezam: profiles: @@ -149,7 +173,8 @@ services: container_name: tezam hostname: tezam depends_on: - - zookeeper + zookeeper: + condition: service_healthy restart: on-failure:3 environment: USER: hive @@ -177,7 +202,8 @@ services: - llap image: apache/hive:${HIVE_VERSION} depends_on: - - zookeeper + zookeeper: + condition: service_healthy restart: unless-stopped environment: USER: hive @@ -205,6 +231,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/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."