Created
February 23, 2023 07:15
-
-
Save copuzzle/7a3095095a312cb3ef47c683fc718cfb to your computer and use it in GitHub Desktop.
Kafka 2.7 docker compose cluster for Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # WARNING: This docker-compose.yml is only for testing purpose. | |
| # Parameters: | |
| # name: None | |
| # - description: Major ports are exposed to host computer | |
| # - zookeeper: 2181 | |
| # kafka1: 9091 | |
| # kafka2: 9092 | |
| # kafka3: 9093 | |
| # kafka3: 9094 | |
| # Tips:> | |
| # - You can up part of the cluster with below command. | |
| # $ docker-compose up -d kafka1 kafka2 kafka3 | |
| version: '3.3' | |
| services: | |
| zookeeper: | |
| image: confluentinc/cp-zookeeper:${CONFLUENT_PLATFORM_VERSION:-3.0.0} | |
| ports: | |
| - "2181:2181" | |
| - "2888:2888" | |
| - "3888:3888" | |
| healthcheck: | |
| test: echo stat | nc localhost 2181 | |
| interval: 10s | |
| timeout: 10s | |
| retries: 3 | |
| environment: | |
| - ZOOKEEPER_SERVER_ID=1 | |
| - ZOOKEEPER_CLIENT_PORT=2181 | |
| - ZOOKEEPER_TICK_TIME=2000 | |
| - ZOOKEEPER_INIT_LIMIT=5 | |
| - ZOOKEEPER_SYNC_LIMIT=2 | |
| - ZOOKEEPER_SERVERS=zookeeper:2888:3888 | |
| kafka1: | |
| image: bitnami/kafka:2.7.0-debian-10-r124 | |
| healthcheck: | |
| test: ps augwwx | egrep [S]upportedKafka | |
| depends_on: | |
| - zookeeper | |
| ports: | |
| - "9081:9081" | |
| - "9091:9091" | |
| environment: | |
| - KAFKA_BROKER_ID=1 | |
| - ALLOW_PLAINTEXT_LISTENER=yes | |
| - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,CLIENT:PLAINTEXT | |
| - KAFKA_CFG_LISTENERS=INTERNAL://:9081,CLIENT://:9091 | |
| - KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://host.docker.internal:9081,CLIENT://127.0.0.1:9091 | |
| - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 | |
| - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL | |
| kafka2: | |
| image: bitnami/kafka:2.7.0-debian-10-r124 | |
| healthcheck: | |
| test: ps augwwx | egrep [S]upportedKafka | |
| depends_on: | |
| - zookeeper | |
| ports: | |
| - "9082:9082" | |
| - "9092:9092" | |
| environment: | |
| - KAFKA_BROKER_ID=2 | |
| - ALLOW_PLAINTEXT_LISTENER=yes | |
| - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,CLIENT:PLAINTEXT | |
| - KAFKA_CFG_LISTENERS=INTERNAL://:9082,CLIENT://:9092 | |
| - KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://host.docker.internal:9082,CLIENT://127.0.0.1:9092 | |
| - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 | |
| - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL | |
| kafka3: | |
| image: bitnami/kafka:2.7.0-debian-10-r124 | |
| healthcheck: | |
| test: ps augwwx | egrep [S]upportedKafka | |
| depends_on: | |
| - zookeeper | |
| ports: | |
| - "9083:9083" | |
| - "9093:9093" | |
| environment: | |
| - KAFKA_BROKER_ID=3 | |
| - ALLOW_PLAINTEXT_LISTENER=yes | |
| - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,CLIENT:PLAINTEXT | |
| - KAFKA_CFG_LISTENERS=INTERNAL://:9083,CLIENT://:9093 | |
| - KAFKA_CFG_ADVERTISED_LISTENERS=INTERNAL://host.docker.internal:9083,CLIENT://127.0.0.1:9093 | |
| - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 | |
| - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment