This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 5f2438aeab8 branch-2.1: [opt](docker)Add healthy check for ES and Kafka #47362 (#47414) 5f2438aeab8 is described below commit 5f2438aeab884483aa5d9a7bae121167ac987890 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Sat Jan 25 09:00:50 2025 +0800 branch-2.1: [opt](docker)Add healthy check for ES and Kafka #47362 (#47414) Cherry-picked from #47362 Co-authored-by: Thearas <gaozif...@selectdb.com> --- .../thirdparties/docker-compose/elasticsearch/es.yaml.tpl | 7 ++++++- .../docker-compose/elasticsearch/scripts/es_init.sh | 2 ++ docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docker/thirdparties/docker-compose/elasticsearch/es.yaml.tpl b/docker/thirdparties/docker-compose/elasticsearch/es.yaml.tpl index 5acbec13465..83303c250a0 100644 --- a/docker/thirdparties/docker-compose/elasticsearch/es.yaml.tpl +++ b/docker/thirdparties/docker-compose/elasticsearch/es.yaml.tpl @@ -125,7 +125,7 @@ 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 @@ -133,6 +133,11 @@ services: condition: service_healthy doris--es_8: condition: service_healthy + healthcheck: + test: ls /tmp/SUCCESS + interval: 5s + timeout: 120s + retries: 120 networks: - doris--es diff --git a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh index d6bbeb7ff3b..4a734a504dd 100755 --- a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh +++ b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh @@ -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 diff --git a/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl b/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl index b9d0abce17f..3e8fc50ae28 100644 --- a/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl +++ b/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl @@ -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 @@ -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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org