This is an automated email from the ASF dual-hosted git repository.

hellostephen 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 ea24410faf5 [enhancement][docker] fix kafka docker issue (#45091)
ea24410faf5 is described below

commit ea24410faf5adabb3da5b23ceb0882e18b749a7c
Author: MoanasDaddyXu <xujia...@selectdb.com>
AuthorDate: Fri Dec 6 14:36:57 2024 +0800

    [enhancement][docker] fix kafka docker issue (#45091)
---
 .../docker-compose/kafka/kafka.yaml.tpl             | 21 ++++++++++++---------
 docker/thirdparties/run-thirdparties-docker.sh      | 16 ++++++++--------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl 
b/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl
index 41b721938ff..b9d0abce17f 100644
--- a/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl
+++ b/docker/thirdparties/docker-compose/kafka/kafka.yaml.tpl
@@ -22,19 +22,21 @@ networks:
     ipam:
       driver: default
       config:
-        - subnet: 168.45.0.0/24
-
+        - subnet: 168.51.0.0/24
 services:
     doris--zookeeper:
-        image: wurstmeister/zookeeper
+        image: bitnami/zookeeper
         restart: always
         container_name: doris--zookeeper
         ports:
             - ${DOCKER_ZOOKEEPER_EXTERNAL_PORT}:2181
+        environment:
+            - ZOO_CFG_LISTEN_PORT=2181
+            - ALLOW_ANONYMOUS_LOGIN=yes
         networks:
             - doris--kafka--network
     doris--kafka:
-        image: wurstmeister/kafka 
+        image: bitnami/kafka:2
         restart: always
         container_name: doris--kafka
         depends_on:
@@ -42,11 +44,12 @@ services:
         ports:
             - ${DOCKER_KAFKA_EXTERNAL_PORT}:19193
         environment:
-            KAFKA_ZOOKEEPER_CONNECT: doris--zookeeper:2181/kafka
-            KAFKA_LISTENERS: PLAINTEXT://:19193
-            KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:19193
-            KAFKA_BROKER_ID: 1
+            - KAFKA_BROKER_ID=1
+            - KAFKA_LISTENERS=PLAINTEXT://:19193
+            - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:19193
+            - KAFKA_ZOOKEEPER_CONNECT=doris--zookeeper:2181
+            - ALLOW_PLAINTEXT_LISTENER=yes
         volumes:
             - /var/run/docker.sock:/var/run/docker.sock
         networks:
-            - doris--kafka--network
+            - doris--kafka--network
\ No newline at end of file
diff --git a/docker/thirdparties/run-thirdparties-docker.sh 
b/docker/thirdparties/run-thirdparties-docker.sh
index 1f69f81477f..f2340b57748 100755
--- a/docker/thirdparties/run-thirdparties-docker.sh
+++ b/docker/thirdparties/run-thirdparties-docker.sh
@@ -291,23 +291,23 @@ start_clickhouse() {
 start_kafka() {
     # kafka
     KAFKA_CONTAINER_ID="${CONTAINER_UID}kafka"
-    eth0_num=$(ifconfig -a|grep flags=|grep -n ^eth0|awk -F ':' '{print $1}')
-    IP_HOST=$(ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk 
'{print $2}'|tr -d "addr:"|tail -n +${eth0_num}|head -n 1)
+    eth_name=$(ifconfig -a | grep -E "^eth[0-9]" | sort -k1.4n | awk -F ':' 
'{print $1}' | head -n 1)
+    IP_HOST=$(ifconfig "${eth_name}" | grep inet | grep -v 127.0.0.1 | grep -v 
inet6 | awk '{print $2}' | tr -d "addr:" | head -n 1)
     cp "${ROOT}"/docker-compose/kafka/kafka.yaml.tpl 
"${ROOT}"/docker-compose/kafka/kafka.yaml
     sed -i "s/doris--/${CONTAINER_UID}/g" 
"${ROOT}"/docker-compose/kafka/kafka.yaml
     sed -i "s/localhost/${IP_HOST}/g" "${ROOT}"/docker-compose/kafka/kafka.yaml
     sudo docker compose -f "${ROOT}"/docker-compose/kafka/kafka.yaml 
--env-file "${ROOT}"/docker-compose/kafka/kafka.env down
 
     create_kafka_topics() {
-       local container_id="$1"
-       local ip_host="$2"
-       local backup_dir=/home/work/pipline/backup_center
+        local container_id="$1"
+        local ip_host="$2"
+        local backup_dir=/home/work/pipline/backup_center
 
-        declare -a topics=("basic_data" "basic_array_data" 
"basic_data_with_errors" "basic_array_data_with_errors" "basic_data_timezone" 
"basic_array_data_timezone")
+        declare -a topics=("basic_data" "basic_array_data" 
"basic_data_with_errors" "basic_array_data_with_errors" "basic_data_timezone" 
"basic_array_data_timezone" "trino_kafka_basic_data")
 
         for topic in "${topics[@]}"; do
-            echo "docker exec "${container_id}" bash -c echo 
'/opt/kafka/bin/kafka-topics.sh --create --broker-list '${ip_host}:19193' 
--topic '${topic}'" 
-            docker exec "${container_id}" bash -c 
"/opt/kafka/bin/kafka-topics.sh --create --broker-list '${ip_host}:19193' 
--topic '${topic}'"
+            echo "docker exec "${container_id}" bash -c echo 
'/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server 
'${ip_host}:19193' --topic '${topic}'"
+            docker exec "${container_id}" bash -c 
"/opt/bitnami/kafka/bin/kafka-topics.sh --create --bootstrap-server 
'${ip_host}:19193' --topic '${topic}'"
         done
 
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to