Skip to content

Commit

Permalink
branch-3.0: [opt](docker)Add healthy check for ES and Kafka #47362 (#…
Browse files Browse the repository at this point in the history
…47413)

Cherry-picked from #47362

Co-authored-by: Thearas <[email protected]>
  • Loading branch information
github-actions[bot] and Thearas authored Jan 26, 2025
1 parent 2ce46b9 commit 0ac6547
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docker/thirdparties/docker-compose/elasticsearch/es.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,19 @@ services:
ES_6_HOST: "doris--es_6"
ES_7_HOST: "doris--es_7"
ES_8_HOST: "doris--es_8"
command: [ "sh","-c","/mnt/scripts/es_init.sh" ]
command: [ "sh", "-c", "/mnt/scripts/es_init.sh" ]
depends_on:
doris--es_6:
condition: service_healthy
doris--es_7:
condition: service_healthy
doris--es_8:
condition: service_healthy
healthcheck:
test: ls /tmp/SUCCESS
interval: 5s
timeout: 120s
retries: 120
networks:
- doris--es

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ generate_bulk_request "composite_type_array" "" "item_" "$array_data_file" "$bul
curl -X POST "http://${ES_8_HOST}:9200/_bulk" --data-binary "@$bulk_request_file" -H "Content-Type: application/json"
# put _meta for composite_type_array
curl "http://${ES_8_HOST}:9200/composite_type_array/_mapping" -H "Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta_composite_type_array.json"

touch /tmp/SUCCESS
14 changes: 14 additions & 0 deletions docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ services:
container_name: doris--zookeeper
ports:
- ${DOCKER_ZOOKEEPER_EXTERNAL_PORT}:2181
healthcheck:
# https://github.com/bitnami/charts/blob/62399ed3863e70775d66f9581e28129026a86e5d/bitnami/zookeeper/templates/statefulset.yaml#L404
test: /bin/bash -ec ZOO_HC_TIMEOUT=10 /opt/bitnami/scripts/zookeeper/healthcheck.sh
start_period: 10s
interval: 5s
timeout: 60s
retries: 60
environment:
- ZOO_CFG_LISTEN_PORT=2181
- ALLOW_ANONYMOUS_LOGIN=yes
Expand All @@ -43,6 +50,13 @@ services:
- doris--zookeeper
ports:
- ${DOCKER_KAFKA_EXTERNAL_PORT}:19193
healthcheck:
# https://github.com/bitnami/containers/issues/33325#issuecomment-1541443315
test: kafka-topics.sh --zookeeper doris--zookeeper:2181 --topic healthycheck --partitions 1 --replication-factor 1 --create --if-not-exists && kafka-topics.sh --zookeeper doris--zookeeper:2181 --topic healthycheck --describe
start_period: 10s
interval: 10s
timeout: 60s
retries: 60
environment:
- KAFKA_BROKER_ID=1
- KAFKA_LISTENERS=PLAINTEXT://:19193
Expand Down

0 comments on commit 0ac6547

Please sign in to comment.