X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=docker-compose.yml;h=11c5c8d9cf67d463f53e4bc673b02d5dc42290ee;hb=ece4cdf8b47768f518c21aea12bcd0dadc7c91e1;hp=1aff5f2097c0385854621a835a5d684871b6bf62;hpb=ec0a4f3ff56c4a8a14e1ae1ce836d53272993cc9;p=demos%2Fkafka%2Ftraining diff --git a/docker-compose.yml b/docker-compose.yml index 1aff5f2..11c5c8d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,62 @@ version: '3.2' services: zookeeper: - image: confluentinc/cp-zookeeper:7.0.2 + image: confluentinc/cp-zookeeper:7.1.3 environment: ZOOKEEPER_CLIENT_PORT: 2181 ports: - 2181:2181 - kafka: - image: confluentinc/cp-kafka:7.0.2 + kafka-1: + image: confluentinc/cp-kafka:7.1.3 environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9081 + KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-1:9092, LOCALHOST://localhost:9081 + KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" + ports: + - 9081:9081 + depends_on: + - zookeeper + + kafka-2: + image: confluentinc/cp-kafka:7.1.3 + environment: + KAFKA_BROKER_ID: 2 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9082 - KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka:9092, LOCALHOST://localhost:9082 + KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-2:9092, LOCALHOST://localhost:9082 KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" ports: - 9092:9082 - 9082:9082 + networks: + default: + aliases: + - kafka + depends_on: + - zookeeper + + kafka-3: + image: confluentinc/cp-kafka:7.1.3 + environment: + KAFKA_BROKER_ID: 3 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9083 + KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-3:9092, LOCALHOST://localhost:9083 + KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" + ports: + - 9083:9083 depends_on: - zookeeper @@ -29,28 +65,76 @@ services: command: > bash -c " kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test - kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 + kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2 + kafka-topics --bootstrap-server kafka:9092 --describe --topic test " cli: image: juplo/toolbox command: sleep infinity - producer: + producer-0: image: juplo/rest-producer:1.0-SNAPSHOT ports: - - 8080:8080 + - 8000:8080 environment: + server.port: 8080 producer.bootstrap-server: kafka:9092 producer.client-id: producer producer.topic: test + producer.partition: 0 - consumer: - image: juplo/endless-consumer:1.0-SNAPSHOT + producer-1: + image: juplo/rest-producer:1.0-SNAPSHOT ports: - - 8081:8081 + - 8001:8080 + environment: + server.port: 8080 + producer.bootstrap-server: kafka:9092 + producer.client-id: producer + producer.topic: test + producer.partition: 1 + + peter: + image: juplo/rest-client:1.0-SNAPSHOT + environment: + server.port: 8080 + rest-client.baseUrl: http://producer-1:8080 + rest-client.username: peter + rest-client.throttle-ms: 1000 + + klaus: + image: juplo/rest-client:1.0-SNAPSHOT environment: - consumer.bootstrap-server: kafka:9092 - consumer.client-id: my-group - consumer.client-id: consumer - consumer.topic: test + server.port: 8080 + rest-client.baseUrl: http://producer-1:8080 + rest-client.username: klaus + rest-client.throttle-ms: 1100 + + beate: + image: juplo/rest-client:1.0-SNAPSHOT + environment: + server.port: 8080 + rest-client.baseUrl: http://producer-0:8080 + rest-client.username: beate + rest-client.throttle-ms: 900 + + franz: + image: juplo/rest-client:1.0-SNAPSHOT + environment: + server.port: 8080 + rest-client.baseUrl: http://producer-1:8080 + rest-client.username: franz + rest-client.throttle-ms: 800 + + uschi: + image: juplo/rest-client:1.0-SNAPSHOT + environment: + server.port: 8080 + rest-client.baseUrl: http://producer-0:8080 + rest-client.username: uschi + rest-client.throttle-ms: 1200 + + consumer: + image: juplo/toolbox + command: kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n'