From 65fb32d97f105a83a2a1a10ddb448091d54ce349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=8D=E7=BC=96=E8=AF=91=E5=B7=A5=E4=BD=9C=E5=8C=BA?= Date: Fri, 1 May 2026 22:51:33 +0800 Subject: [PATCH] fix: restore ZK, use confluentinc/cp-zookeeper:7.5.0 + cp-kafka:7.5.0 (both locally available) Former-commit-id: 8fffa72c508a4008e2d7790a307eb1e2e4602cde --- scripts/test-env/docker-compose.infra.yml | 23 ++++++++++++++++------- scripts/test-env/setup.sh | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/test-env/docker-compose.infra.yml b/scripts/test-env/docker-compose.infra.yml index e541a5db..0773759a 100644 --- a/scripts/test-env/docker-compose.infra.yml +++ b/scripts/test-env/docker-compose.infra.yml @@ -20,6 +20,16 @@ services: - "6379:6379" command: redis-server --requirepass "1qaz!QAZ" + zookeeper: + image: confluentinc/cp-zookeeper:7.5.0 + container_name: v2test-zookeeper + restart: unless-stopped + ports: + - "2181:2181" + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + kafka: image: confluentinc/cp-kafka:7.5.0 container_name: v2test-kafka @@ -27,15 +37,14 @@ services: ports: - "9092:9092" environment: - KAFKA_NODE_ID: 1 - KAFKA_PROCESS_ROLES: "broker,controller" - KAFKA_CONTROLLER_QUORUM_VOTERS: "1@localhost:9093" - KAFKA_LISTENERS: "PLAINTEXT://:9092,CONTROLLER://:9093" + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://localhost:9092" - KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER" - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT" + KAFKA_LISTENERS: "PLAINTEXT://:9092" KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - CLUSTER_ID: "v2test-cluster-001" + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" + depends_on: + - zookeeper nginx: image: nginx:alpine diff --git a/scripts/test-env/setup.sh b/scripts/test-env/setup.sh index c5379fd2..c2547505 100755 --- a/scripts/test-env/setup.sh +++ b/scripts/test-env/setup.sh @@ -51,7 +51,7 @@ log_ok "MySQL: $MYSQL_HOST:$MYSQL_PORT OK" # 端口冲突 CONFLICT_PORTS="" -for port in 8500 6379 9092 8090 18080 18081 16106 17011 3721; do +for port in 8500 6379 9092 2181 8090 18080 18081 16106 17011 3721; do if ss -tlnp 2>/dev/null | grep -q ":$port "; then CONFLICT_PORTS="$CONFLICT_PORTS $port" fi