From: Kai Moritz Date: Sat, 4 May 2024 13:22:33 +0000 (+0200) Subject: Setup auf einen Broker zurückgestutzt X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=249c2463458de1fd817a23d3a9d02990b56f39e3;p=demos%2Fkafka%2Ftraining Setup auf einen Broker zurückgestutzt --- diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9dc76ad..ac11999 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,64 +9,25 @@ services: - zookeeper-data:/var/lib/zookeeper/data - zookeeper-log:/var/lib/zookeeper/log - kafka-1: - image: confluentinc/cp-kafka:7.5.1 - environment: - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9081 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-1:9092, LOCALHOST://localhost:9081 - KAFKA_BROKER_ID: 1 - KAFKA_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" - volumes: - - kafka-1-data:/var/lib/kafka/data - ports: - - 9081:9081 - stop_grace_period: 120s - depends_on: - - zookeeper - - kafka-2: + kafka: image: confluentinc/cp-kafka:7.5.1 environment: KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9082 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-2:9092, LOCALHOST://localhost:9082 - KAFKA_BROKER_ID: 2 + KAFKA_ADVERTISED_LISTENERS: BROKER://kafka:9092, LOCALHOST://localhost:9082 + KAFKA_BROKER_ID: 1 KAFKA_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 + KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" volumes: - - kafka-2-data:/var/lib/kafka/data + - kafka-data:/var/lib/kafka/data ports: - 9092:9082 - 9082:9082 - networks: - default: - aliases: - - kafka - stop_grace_period: 120s - depends_on: - - zookeeper - - kafka-3: - image: confluentinc/cp-kafka:7.5.1 - environment: - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_LISTENERS: BROKER://:9092, LOCALHOST://:9083 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: BROKER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_ADVERTISED_LISTENERS: BROKER://kafka-3:9092, LOCALHOST://localhost:9083 - KAFKA_BROKER_ID: 3 - KAFKA_INTER_BROKER_LISTENER_NAME: BROKER - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" - volumes: - - kafka-3-data:/var/lib/kafka/data - ports: - - 9083:9083 stop_grace_period: 120s depends_on: - zookeeper @@ -74,21 +35,19 @@ services: schema-registry: image: confluentinc/cp-schema-registry:7.5.1 environment: - SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9092,kafka-3:9092 + SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9092 SCHEMA_REGISTRY_HOST_NAME: schema-registry SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8085 SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: INFO ports: - 8085:8085 depends_on: - - kafka-1 - - kafka-2 - - kafka-3 + - kafka connect: image: confluentinc/cp-kafka-connect:7.5.1 environment: - CONNECT_BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9092,kafka-3:9092 + CONNECT_BOOTSTRAP_SERVERS: kafka:9092 CONNECT_REST_PORT: 8083 CONNECT_REST_LISTENERS: http://0.0.0.0:8083 CONNECT_REST_ADVERTISED_HOST_NAME: connect @@ -123,9 +82,7 @@ services: command: sleep infinity stop_grace_period: 0s depends_on: - - kafka-1 - - kafka-2 - - kafka-3 + - kafka setup: image: juplo/toolbox @@ -133,7 +90,7 @@ services: - bash - -c - | - cub kafka-ready -b kafka-1:9092,kafka-2:9092,kafka-3:9092 3 60 > /dev/null 2>&1 || exit 1 + cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1 if [ -e INITIALIZED ] then echo -n Bereits konfiguriert: @@ -148,8 +105,8 @@ services: --create \ --topic test \ --partitions 2 \ - --replication-factor 3 \ - --config min.insync.replicas=2 \ + --replication-factor 1 \ + --config min.insync.replicas=1 \ && echo Das Topic \'test\' wurde erfolgreich angelegt: \ && kafka-topics --bootstrap-server kafka:9092 --describe --topic test \ && date > INITIALIZED @@ -189,9 +146,7 @@ services: - name: "connect" url: "http://connect:8083" depends_on: - - kafka-1 - - kafka-2 - - kafka-3 + - kafka minio: image: minio/minio:latest @@ -208,7 +163,5 @@ services: volumes: zookeeper-data: zookeeper-log: - kafka-1-data: - kafka-2-data: - kafka-3-data: + kafka-data: minio: