From 31ec44e21a2702fc92dc9341db054cba0d96aaaa 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:57:47 +0800 Subject: [PATCH] fix: reuse existing ybs-kafka/ybs-zookeeper, move Consul to 9517, remove ZK/Kafka from compose Former-commit-id: c7aff428fd4b259c9795da76ce4a53be29f9fe4d --- scripts/test-env/config/env.sh | 2 +- scripts/test-env/docker-compose.infra.yml | 28 +---------------------- scripts/test-env/setup.sh | 5 ++-- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/scripts/test-env/config/env.sh b/scripts/test-env/config/env.sh index 6513bdd1..12b79b6c 100644 --- a/scripts/test-env/config/env.sh +++ b/scripts/test-env/config/env.sh @@ -34,7 +34,7 @@ REDIS_HOST=127.0.0.1 REDIS_PORT=6380 REDIS_PASS="1qaz!QAZ" CONSUL_HOST=127.0.0.1 -CONSUL_PORT=8500 +CONSUL_PORT=9517 KAFKA_HOST=127.0.0.1 KAFKA_PORT=9092 ZK_HOST=127.0.0.1 diff --git a/scripts/test-env/docker-compose.infra.yml b/scripts/test-env/docker-compose.infra.yml index ea4c8a1f..5e14d2e5 100644 --- a/scripts/test-env/docker-compose.infra.yml +++ b/scripts/test-env/docker-compose.infra.yml @@ -4,7 +4,7 @@ services: container_name: v2test-consul restart: unless-stopped ports: - - "8500:8500" + - "9517:8500" command: > agent -server -bootstrap-expect=1 -ui -client=0.0.0.0 -bind=0.0.0.0 @@ -20,32 +20,6 @@ services: - "6380: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 - restart: unless-stopped - ports: - - "9092:9092" - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://localhost:9092" - KAFKA_LISTENERS: "PLAINTEXT://:9092" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" - depends_on: - - zookeeper - nginx: image: nginx:alpine container_name: v2test-nginx diff --git a/scripts/test-env/setup.sh b/scripts/test-env/setup.sh index f76f39c5..dd82ba81 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 6380 9092 2181 8090 18080 18081 16106 17011 3721; do +for port in 9517 6380 8090 18080 18081 16106 17011 3721; do if ss -tlnp 2>/dev/null | grep -q ":$port "; then CONFLICT_PORTS="$CONFLICT_PORTS $port" fi @@ -78,8 +78,7 @@ cd "$SCRIPT_DIR" # Stop and remove any existing v2test containers and conflicting containers log_info "Cleaning up existing containers..." -docker rm -f v2test-consul v2test-redis v2test-kafka v2test-zookeeper v2test-nginx \ - cw-frontend-local-nginx v2-test-redis 2>/dev/null || true +docker rm -f v2test-consul v2test-redis v2test-nginx cw-frontend-local-nginx v2-test-redis 2>/dev/null || true docker compose -f docker-compose.infra.yml down --remove-orphans 2>/dev/null || true docker compose -f docker-compose.infra.yml up -d