├── .gitignore ├── conduktor.yml ├── zk-single-kafka-single.yml ├── .github └── workflows │ └── main.yml ├── zk-multiple-kafka-single.yml ├── conduktor-kafka-single.yml ├── test.sh ├── jmx-exporter.yml ├── zk-single-kafka-multiple.yml ├── zk-multiple-kafka-multiple.yml ├── zk-multiple-kafka-multiple-schema-registry.yml ├── full-stack.yml ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | zk-single-kafka-single/* 2 | zk-single-kafka-multiple/* 3 | zk-multiple-kafka-single/* 4 | zk-multiple-kafka-multiple/* 5 | zk-multiple-kafka-multiple-schema-registry/* 6 | full-stack/* 7 | .idea/ -------------------------------------------------------------------------------- /conduktor.yml: -------------------------------------------------------------------------------- 1 | services: 2 | postgresql: 3 | image: postgres:14 4 | hostname: postgresql 5 | volumes: 6 | - pg_data:/var/lib/postgresql/data 7 | environment: 8 | POSTGRES_DB: "conduktor-console" 9 | POSTGRES_USER: "conduktor" 10 | POSTGRES_PASSWORD: "some_password" 11 | POSTGRES_HOST_AUTH_METHOD: "scram-sha-256" 12 | conduktor-console: 13 | image: conduktor/conduktor-console:1.41.0 14 | ports: 15 | - "8080:8080" 16 | volumes: 17 | - conduktor_data:/var/conduktor 18 | environment: 19 | CDK_DATABASE_URL: "postgresql://conduktor:some_password@postgresql:5432/conduktor-console" 20 | CDK_CLUSTERS_0_ID: "default" 21 | CDK_CLUSTERS_0_NAME: "My Local Kafka Cluster" 22 | CDK_CLUSTERS_0_COLOR: "#0013E7" 23 | CDK_CLUSTERS_0_BOOTSTRAPSERVERS: "PLAINTEXT://kafka1:19092" 24 | CDK_CLUSTERS_0_SCHEMAREGISTRY_URL: "http://kafka-schema-registry:8081" 25 | CDK_CLUSTERS_0_KAFKACONNECTS_0_URL: "http://kafka-connect:8083" 26 | CDK_CLUSTERS_0_KAFKACONNECTS_0_NAME: "full stack kafka connect" 27 | # CONSOLE_JAVA_OPTS: "-XX:UseSVE=0" 28 | volumes: 29 | pg_data: {} 30 | conduktor_data: {} 31 | -------------------------------------------------------------------------------- /zk-single-kafka-single.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888 12 | 13 | kafka1: 14 | image: confluentinc/cp-kafka:7.8.0 15 | hostname: kafka1 16 | container_name: kafka1 17 | ports: 18 | - "9092:9092" 19 | - "29092:29092" 20 | - "9999:9999" 21 | environment: 22 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 23 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 24 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 25 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181" 26 | KAFKA_BROKER_ID: 1 27 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 28 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 29 | KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 30 | KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 31 | KAFKA_JMX_PORT: 9999 32 | KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1} 33 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 34 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 35 | depends_on: 36 | - zoo1 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the master branch 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | env: 13 | DOCKER_HOST_IP: 127.0.0.1 14 | 15 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 16 | jobs: 17 | # This workflow contains a single job called "build" 18 | build: 19 | # The type of runner that the job will run on 20 | runs-on: ubuntu-latest 21 | 22 | # Steps represent a sequence of tasks that will be executed as part of the job 23 | steps: 24 | 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | - name: add kafka repo key 28 | run: wget -qO - https://packages.confluent.io/deb/4.0/archive.key | sudo apt-key add - 29 | 30 | - name: add kafka binary repo 31 | run: sudo add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/4.0 stable main" 32 | 33 | - name: install kafka binary 34 | run: sudo apt-get install confluent-platform-oss-2.11 35 | 36 | 37 | # Runs a set of commands using the runners shell 38 | - name: run test single 2 39 | run: ./test.sh zk-single-kafka-single.yml 2 40 | 41 | - name: run test single 4 42 | run: ./test.sh zk-multiple-kafka-single.yml 4 43 | 44 | - name: run test multiple 4 45 | run: ./test.sh zk-single-kafka-multiple.yml 4 46 | 47 | - name: run test multiple 6 48 | run: ./test.sh zk-multiple-kafka-multiple.yml 6 49 | 50 | - name: run test multiple-schema-registry 7 51 | run: ./test.sh zk-multiple-kafka-multiple-schema-registry.yml 7 52 | 53 | - name: run test full-stack 8 54 | run: ./test.sh full-stack.yml 8 55 | 56 | - name: run test conduktor-kafka-single 3 57 | run: ./test.sh conduktor-kafka-single.yml 3 58 | 59 | -------------------------------------------------------------------------------- /zk-multiple-kafka-single.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 12 | 13 | zoo2: 14 | image: confluentinc/cp-zookeeper:7.8.0 15 | hostname: zoo2 16 | container_name: zoo2 17 | ports: 18 | - "2182:2182" 19 | environment: 20 | ZOOKEEPER_CLIENT_PORT: 2182 21 | ZOOKEEPER_SERVER_ID: 2 22 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 23 | 24 | zoo3: 25 | image: confluentinc/cp-zookeeper:7.8.0 26 | hostname: zoo3 27 | container_name: zoo3 28 | ports: 29 | - "2183:2183" 30 | environment: 31 | ZOOKEEPER_CLIENT_PORT: 2183 32 | ZOOKEEPER_SERVER_ID: 3 33 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 34 | 35 | 36 | kafka1: 37 | image: confluentinc/cp-kafka:7.8.0 38 | hostname: kafka1 39 | container_name: kafka1 40 | ports: 41 | - "9092:9092" 42 | - "29092:29092" 43 | - "9999:9999" 44 | environment: 45 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 46 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 47 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 48 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 49 | KAFKA_BROKER_ID: 1 50 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 51 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 52 | KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 53 | KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 54 | KAFKA_JMX_PORT: 9999 55 | KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1} 56 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 57 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 58 | depends_on: 59 | - zoo1 60 | - zoo2 61 | - zoo3 62 | -------------------------------------------------------------------------------- /conduktor-kafka-single.yml: -------------------------------------------------------------------------------- 1 | services: 2 | postgresql: 3 | image: postgres:14 4 | hostname: postgresql 5 | volumes: 6 | - pg_data:/var/lib/postgresql/data 7 | environment: 8 | POSTGRES_DB: "conduktor-console" 9 | POSTGRES_USER: "conduktor" 10 | POSTGRES_PASSWORD: "some_password" 11 | POSTGRES_HOST_AUTH_METHOD: "scram-sha-256" 12 | conduktor-console: 13 | image: conduktor/conduktor-console:1.36.2 14 | ports: 15 | - "8080:8080" 16 | volumes: 17 | - conduktor_data:/var/conduktor 18 | environment: 19 | CDK_DATABASE_URL: "postgresql://conduktor:some_password@postgresql:5432/conduktor-console" 20 | CDK_CLUSTERS_0_ID: "default" 21 | CDK_CLUSTERS_0_NAME: "My Local Kafka Cluster" 22 | CDK_CLUSTERS_0_COLOR: "#0013E7" 23 | CDK_CLUSTERS_0_BOOTSTRAPSERVERS: "PLAINTEXT://kafka1:19092" 24 | # CONSOLE_JAVA_OPTS: "-XX:UseSVE=0" 25 | kafka1: 26 | image: confluentinc/cp-kafka:8.0.0 27 | hostname: kafka1 28 | container_name: kafka1 29 | ports: 30 | - "9092:9092" 31 | - "29092:29092" 32 | - "9999:9999" # JMX Port 33 | - "9099:9099" # Internal inter-broker communication 34 | environment: 35 | environment: 36 | CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk 37 | KAFKA_NODE_ID: 1 38 | KAFKA_PROCESS_ROLES: broker,controller 39 | KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka1:9099" 40 | KAFKA_LISTENERS: INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092,DOCKER://0.0.0.0:29092,CONTROLLER://0.0.0.0:9099 41 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 42 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT,CONTROLLER:PLAINTEXT 43 | KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER 44 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 45 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 46 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 47 | KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 48 | KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 49 | KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer 50 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 51 | volumes: 52 | pg_data: {} 53 | conduktor_data: {} -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | export file=$1 5 | #!/bin/bash 6 | f () { 7 | errcode=$? # save the exit code as the first thing done in the trap function 8 | echo "error $errorcode" 9 | echo "the command executing at the time of the error was" 10 | echo "$BASH_COMMAND" 11 | echo "on line ${BASH_LINENO[0]}" 12 | # do some error handling, cleanup, logging, notification 13 | # $BASH_COMMAND contains the command that was being executed at the time of the trap 14 | # ${BASH_LINENO[0]} contains the line number in the script of that command 15 | # exit the script or return to try again, etc. 16 | # creating stack... 17 | docker compose -f $file down 18 | exit $errcode # or use some other value or do return instead 19 | } 20 | trap f ERR 21 | 22 | all_great(){ 23 | # for testing 24 | echo "Verifying Process" 25 | running=`docker compose -f $1 ps | grep Up | wc -l` 26 | if [ "$running" != "$2" ]; then 27 | # for logging 28 | docker compose -f $1 ps 29 | # debug 30 | docker compose -f $1 logs 31 | exit 1 32 | fi 33 | } 34 | 35 | kafka_tests(){ 36 | echo "Testing Kafka" 37 | topic="testtopic" 38 | if grep -q kafka3 $1; then replication_factor="3"; else replication_factor="1"; fi 39 | for i in 1 2 3 4 5; do echo "trying to create test topic" && kafka-topics --create --topic $topic --replication-factor $replication_factor --partitions 12 --zookeeper $DOCKER_HOST_IP:2181 && break || sleep 5; done 40 | sleep 5 41 | for x in {1..100}; do echo $x; done | kafka-console-producer --broker-list $DOCKER_HOST_IP:9092 --topic $topic 42 | sleep 5 43 | rows=`kafka-console-consumer --bootstrap-server $DOCKER_HOST_IP:9092 --topic $topic --from-beginning --timeout-ms 10000 | wc -l` 44 | # rows=`kafkacat -C -b $DOCKER_HOST_IP:9092 -t $topic -o beginning -e | wc -l ` 45 | if [ "$rows" != "100" ]; then 46 | kafka-console-consumer --bootstrap-server $DOCKER_HOST_IP:9092 --topic test-topic --from-beginning --timeout-ms 10000 | wc -l 47 | exit 1 48 | else 49 | echo "Kafka Test Success" 50 | fi 51 | } 52 | 53 | # creating stack... 54 | docker compose -f $file down -v 55 | docker compose -f $file up -d 56 | sleep 30 57 | # logging 58 | docker compose -f $file ps 59 | # tests 60 | all_great $1 $2 61 | kafka_tests $1 62 | all_great $1 $2 63 | # teardown 64 | docker compose -f $file down -v 65 | echo "Success!" -------------------------------------------------------------------------------- /jmx-exporter.yml: -------------------------------------------------------------------------------- 1 | lowercaseOutputName: true 2 | lowercaseOutputLabelNames: true 3 | rules: 4 | # Special cases and very specific rules 5 | - pattern : kafka.server<>Value 6 | name: kafka_server_$1_$2 7 | type: GAUGE 8 | labels: 9 | clientId: "$3" 10 | topic: "$4" 11 | partition: "$5" 12 | - pattern : kafka.server<>Value 13 | name: kafka_server_$1_$2 14 | type: GAUGE 15 | labels: 16 | clientId: "$3" 17 | broker: "$4:$5" 18 | 19 | - pattern : kafka.server<>OneMinuteRate 20 | name: kafka_server_kafkarequesthandlerpool_requesthandleravgidlepercent_total 21 | type: GAUGE 22 | 23 | - pattern : kafka.server<>connections 24 | name: kafka_server_socketservermetrics_connections 25 | type: GAUGE 26 | labels: 27 | client_software_name: "$1" 28 | client_software_version: "$2" 29 | listener: "$3" 30 | network_processor: "$4" 31 | 32 | - pattern : 'kafka.server<>(.+):' 33 | name: kafka_server_socketservermetrics_$3 34 | type: GAUGE 35 | labels: 36 | listener: "$1" 37 | network_processor: "$2" 38 | 39 | # Count and Value 40 | - pattern: kafka.(.+)<>(Count|Value) 41 | name: kafka_$1_$2_$3 42 | labels: 43 | "$4": "$5" 44 | "$6": "$7" 45 | - pattern: kafka.(.+)<>(Count|Value) 46 | name: kafka_$1_$2_$3 47 | labels: 48 | "$4": "$5" 49 | - pattern: kafka.(.+)<>(Count|Value) 50 | name: kafka_$1_$2_$3 51 | 52 | # Percentile 53 | - pattern: kafka.(.+)<>(\d+)thPercentile 54 | name: kafka_$1_$2_$3 55 | type: GAUGE 56 | labels: 57 | "$4": "$5" 58 | "$6": "$7" 59 | quantile: "0.$8" 60 | - pattern: kafka.(.+)<>(\d+)thPercentile 61 | name: kafka_$1_$2_$3 62 | type: GAUGE 63 | labels: 64 | "$4": "$5" 65 | quantile: "0.$6" 66 | - pattern: kafka.(.+)<>(\d+)thPercentile 67 | name: kafka_$1_$2_$3 68 | type: GAUGE 69 | labels: 70 | quantile: "0.$4" 71 | -------------------------------------------------------------------------------- /zk-single-kafka-multiple.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888 12 | 13 | 14 | kafka1: 15 | image: confluentinc/cp-kafka:7.8.0 16 | hostname: kafka1 17 | container_name: kafka1 18 | ports: 19 | - "9092:9092" 20 | - "29092:29092" 21 | environment: 22 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 23 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 24 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 25 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181" 26 | KAFKA_BROKER_ID: 1 27 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 28 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 29 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 30 | depends_on: 31 | - zoo1 32 | 33 | kafka2: 34 | image: confluentinc/cp-kafka:7.8.0 35 | hostname: kafka2 36 | container_name: kafka2 37 | ports: 38 | - "9093:9093" 39 | - "29093:29093" 40 | environment: 41 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:19093,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093,DOCKER://host.docker.internal:29093 42 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 43 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 44 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181" 45 | KAFKA_BROKER_ID: 2 46 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 47 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 48 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 49 | depends_on: 50 | - zoo1 51 | 52 | 53 | kafka3: 54 | image: confluentinc/cp-kafka:7.8.0 55 | hostname: kafka3 56 | container_name: kafka3 57 | ports: 58 | - "9094:9094" 59 | - "29094:29094" 60 | environment: 61 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka3:19094,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094,DOCKER://host.docker.internal:29094 62 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 63 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 64 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181" 65 | KAFKA_BROKER_ID: 3 66 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 67 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 68 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 69 | depends_on: 70 | - zoo1 -------------------------------------------------------------------------------- /zk-multiple-kafka-multiple.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 12 | 13 | zoo2: 14 | image: confluentinc/cp-zookeeper:7.8.0 15 | hostname: zoo2 16 | container_name: zoo2 17 | ports: 18 | - "2182:2182" 19 | environment: 20 | ZOOKEEPER_CLIENT_PORT: 2182 21 | ZOOKEEPER_SERVER_ID: 2 22 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 23 | 24 | zoo3: 25 | image: confluentinc/cp-zookeeper:7.8.0 26 | hostname: zoo3 27 | container_name: zoo3 28 | ports: 29 | - "2183:2183" 30 | environment: 31 | ZOOKEEPER_CLIENT_PORT: 2183 32 | ZOOKEEPER_SERVER_ID: 3 33 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 34 | 35 | 36 | 37 | kafka1: 38 | image: confluentinc/cp-kafka:7.8.0 39 | hostname: kafka1 40 | container_name: kafka1 41 | ports: 42 | - "9092:9092" 43 | - "29092:29092" 44 | environment: 45 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 46 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 47 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 48 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 49 | KAFKA_BROKER_ID: 1 50 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 51 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 52 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 53 | depends_on: 54 | - zoo1 55 | - zoo2 56 | - zoo3 57 | 58 | kafka2: 59 | image: confluentinc/cp-kafka:7.8.0 60 | hostname: kafka2 61 | container_name: kafka2 62 | ports: 63 | - "9093:9093" 64 | - "29093:29093" 65 | environment: 66 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:19093,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093,DOCKER://host.docker.internal:29093 67 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 68 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 69 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 70 | KAFKA_BROKER_ID: 2 71 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 72 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 73 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 74 | depends_on: 75 | - zoo1 76 | - zoo2 77 | - zoo3 78 | 79 | kafka3: 80 | image: confluentinc/cp-kafka:7.8.0 81 | hostname: kafka3 82 | container_name: kafka3 83 | ports: 84 | - "9094:9094" 85 | - "29094:29094" 86 | environment: 87 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka3:19094,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094,DOCKER://host.docker.internal:29094 88 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 89 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 90 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 91 | KAFKA_BROKER_ID: 3 92 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 93 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 94 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 95 | depends_on: 96 | - zoo1 97 | - zoo2 98 | - zoo3 99 | -------------------------------------------------------------------------------- /zk-multiple-kafka-multiple-schema-registry.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 12 | 13 | zoo2: 14 | image: confluentinc/cp-zookeeper:7.8.0 15 | hostname: zoo2 16 | container_name: zoo2 17 | ports: 18 | - "2182:2182" 19 | environment: 20 | ZOOKEEPER_CLIENT_PORT: 2182 21 | ZOOKEEPER_SERVER_ID: 2 22 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 23 | 24 | zoo3: 25 | image: confluentinc/cp-zookeeper:7.8.0 26 | hostname: zoo3 27 | container_name: zoo3 28 | ports: 29 | - "2183:2183" 30 | environment: 31 | ZOOKEEPER_CLIENT_PORT: 2183 32 | ZOOKEEPER_SERVER_ID: 3 33 | ZOOKEEPER_SERVERS: zoo1:2888:3888;zoo2:2888:3888;zoo3:2888:3888 34 | 35 | 36 | kafka1: 37 | image: confluentinc/cp-kafka:7.8.0 38 | hostname: kafka1 39 | container_name: kafka1 40 | ports: 41 | - "9092:9092" 42 | - "29092:29092" 43 | environment: 44 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 45 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 46 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 47 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 48 | KAFKA_BROKER_ID: 1 49 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 50 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 51 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 52 | depends_on: 53 | - zoo1 54 | - zoo2 55 | - zoo3 56 | 57 | kafka2: 58 | image: confluentinc/cp-kafka:7.8.0 59 | hostname: kafka2 60 | container_name: kafka2 61 | ports: 62 | - "9093:9093" 63 | - "29093:29093" 64 | environment: 65 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:19093,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093,DOCKER://host.docker.internal:29093 66 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 67 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 68 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 69 | KAFKA_BROKER_ID: 2 70 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 71 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 72 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 73 | depends_on: 74 | - zoo1 75 | - zoo2 76 | - zoo3 77 | 78 | kafka3: 79 | image: confluentinc/cp-kafka:7.8.0 80 | hostname: kafka3 81 | container_name: kafka3 82 | ports: 83 | - "9094:9094" 84 | - "29094:29094" 85 | environment: 86 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka3:19094,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094,DOCKER://host.docker.internal:29094 87 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 88 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 89 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183" 90 | KAFKA_BROKER_ID: 3 91 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 92 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 93 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 94 | depends_on: 95 | - zoo1 96 | - zoo2 97 | - zoo3 98 | 99 | kafka-schema-registry: 100 | image: confluentinc/cp-schema-registry:7.8.0 101 | hostname: kafka-schema-registry 102 | container_name: kafka-schema-registry 103 | depends_on: 104 | - zoo1 105 | - zoo2 106 | - zoo3 107 | - kafka1 108 | - kafka2 109 | - kafka3 110 | ports: 111 | - "8081:8081" 112 | environment: 113 | SCHEMA_REGISTRY_HOST_NAME: kafka-schema-registry 114 | SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'PLAINTEXT://kafka1:19092,PLAINTEXT://kafka2:19093,PLAINTEXT://kafka3:19094' 115 | SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081 116 | 117 | -------------------------------------------------------------------------------- /full-stack.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zoo1: 3 | image: confluentinc/cp-zookeeper:7.8.0 4 | hostname: zoo1 5 | container_name: zoo1 6 | ports: 7 | - "2181:2181" 8 | environment: 9 | ZOOKEEPER_CLIENT_PORT: 2181 10 | ZOOKEEPER_SERVER_ID: 1 11 | ZOOKEEPER_SERVERS: zoo1:2888:3888 12 | 13 | kafka1: 14 | image: confluentinc/cp-kafka:7.8.0 15 | hostname: kafka1 16 | container_name: kafka1 17 | ports: 18 | - "9092:9092" 19 | - "29092:29092" 20 | - "9999:9999" 21 | environment: 22 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 23 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT 24 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 25 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181" 26 | KAFKA_BROKER_ID: 1 27 | KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO" 28 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 29 | KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 30 | KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 31 | KAFKA_JMX_PORT: 9001 32 | KAFKA_JMX_HOSTNAME: ${DOCKER_HOST_IP:-127.0.0.1} 33 | KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer 34 | KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" 35 | depends_on: 36 | - zoo1 37 | 38 | kafka-schema-registry: 39 | image: confluentinc/cp-schema-registry:7.8.0 40 | hostname: kafka-schema-registry 41 | container_name: kafka-schema-registry 42 | ports: 43 | - "8081:8081" 44 | environment: 45 | SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092 46 | SCHEMA_REGISTRY_HOST_NAME: kafka-schema-registry 47 | SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081 48 | depends_on: 49 | - zoo1 50 | - kafka1 51 | 52 | 53 | kafka-rest-proxy: 54 | image: confluentinc/cp-kafka-rest:7.8.0 55 | hostname: kafka-rest-proxy 56 | container_name: kafka-rest-proxy 57 | ports: 58 | - "8082:8082" 59 | environment: 60 | # KAFKA_REST_ZOOKEEPER_CONNECT: zoo1:2181 61 | KAFKA_REST_LISTENERS: http://0.0.0.0:8082/ 62 | KAFKA_REST_SCHEMA_REGISTRY_URL: http://kafka-schema-registry:8081/ 63 | KAFKA_REST_HOST_NAME: kafka-rest-proxy 64 | KAFKA_REST_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092 65 | depends_on: 66 | - zoo1 67 | - kafka1 68 | - kafka-schema-registry 69 | 70 | 71 | kafka-connect: 72 | image: confluentinc/cp-kafka-connect:7.8.0 73 | hostname: kafka-connect 74 | container_name: kafka-connect 75 | ports: 76 | - "8083:8083" 77 | environment: 78 | CONNECT_BOOTSTRAP_SERVERS: "kafka1:19092" 79 | CONNECT_REST_PORT: 8083 80 | CONNECT_GROUP_ID: compose-connect-group 81 | CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs 82 | CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets 83 | CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status 84 | CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter 85 | CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://kafka-schema-registry:8081' 86 | CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter 87 | CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://kafka-schema-registry:8081' 88 | CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" 89 | CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" 90 | CONNECT_REST_ADVERTISED_HOST_NAME: "kafka-connect" 91 | CONNECT_LOG4J_ROOT_LOGLEVEL: "INFO" 92 | CONNECT_LOG4J_LOGGERS: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR" 93 | CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1" 94 | CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1" 95 | CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1" 96 | CONNECT_PLUGIN_PATH: '/usr/share/java,/etc/kafka-connect/jars,/usr/share/confluent-hub-components' 97 | volumes: 98 | - ./connectors:/etc/kafka-connect/jars/ 99 | depends_on: 100 | - zoo1 101 | - kafka1 102 | - kafka-schema-registry 103 | - kafka-rest-proxy 104 | command: 105 | - bash 106 | - -c 107 | - | 108 | confluent-hub install --no-prompt debezium/debezium-connector-mysql:latest 109 | confluent-hub install --no-prompt confluentinc/kafka-connect-datagen:0.4.0 110 | /etc/confluent/docker/run 111 | 112 | 113 | ksqldb-server: 114 | image: confluentinc/cp-ksqldb-server:7.8.0 115 | hostname: ksqldb-server 116 | container_name: ksqldb-server 117 | ports: 118 | - "8088:8088" 119 | environment: 120 | KSQL_BOOTSTRAP_SERVERS: PLAINTEXT://kafka1:19092 121 | KSQL_LISTENERS: http://0.0.0.0:8088/ 122 | KSQL_KSQL_SERVICE_ID: ksqldb-server_ 123 | depends_on: 124 | - zoo1 125 | - kafka1 126 | 127 | postgresql: 128 | hostname: postgresql 129 | container_name: postgresql 130 | extends: 131 | service: postgresql 132 | file: conduktor.yml 133 | 134 | conduktor-console: 135 | hostname: conduktor-console 136 | container_name: conduktor-console 137 | extends: 138 | service: conduktor-console 139 | file: conduktor.yml 140 | 141 | volumes: 142 | pg_data: {} 143 | conduktor_data: {} 144 | 145 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Actions Status](https://github.com/conduktor/kafka-stack-docker-compose/workflows/CI/badge.svg)](https://github.com/conduktor/kafka-stack-docker-compose/actions) 2 | 3 | ![logo](https://raw.githubusercontent.com/conduktor/conduktor.io-public/refs/heads/main/logo/logo-signature.png) 4 | # An open-source project by [Conduktor](https://conduktor.io/) 5 | 6 | This project is sponsored by [Conduktor.io](https://www.conduktor.io/), the Enterprise Data Management 7 | Platform for Streaming. 8 | 9 | Once you have started your cluster, you can use Conduktor to easily manage it. 10 | Just connect against `localhost:9092`. If you are on Mac or Windows and want to connect from another container, use `host.docker.internal:29092` 11 | 12 | # kafka-stack-docker-compose 13 | 14 | This replicates as well as possible real deployment configurations, where you have your zookeeper servers and Kafka servers distinct from each other. This solves all the networking hurdles that comes with Docker and Docker Compose, and is compatible cross platform. 15 | 16 | ## Stack 17 | 18 | - Conduktor Platform 19 | - Zookeeper version 20 | - Kafka version 21 | - Kafka Schema Registry 22 | - Kafka Rest Proxy 23 | - Kafka Connect 24 | - ksqlDB Server 25 | - Zoonavigator 26 | 27 | For a UI tool to access your local Kafka cluster, use the free version of [Conduktor](https://www.conduktor.io/get-started). 28 | 29 | # Requirements 30 | 31 | Kafka will be exposed on `127.0.0.1`. 32 | 33 | ## Apple M4 Support 34 | 35 | At the time of writing there is an issue with Apple M4 chip machines and running certain Java based Docker images. 36 | 37 | Modify the `conduktor.yml` file, uncomment the environment variable `CONSOLE_JAVA_OPTS: "-XX:UseSVE=0"`. 38 | 39 | ## Full stack 40 | 41 | To ease you journey with Kafka just connect to [localhost:8080](http://localhost:8080/) 42 | 43 | - Conduktor-platform: `$DOCKER_HOST_IP:8080` 44 | - Single Zookeeper: `$DOCKER_HOST_IP:2181` 45 | - Single Kafka: `$DOCKER_HOST_IP:9092` 46 | - Kafka Schema Registry: `$DOCKER_HOST_IP:8081` 47 | - Kafka Rest Proxy: `$DOCKER_HOST_IP:8082` 48 | - Kafka Connect: `$DOCKER_HOST_IP:8083` 49 | - KSQL Server: `$DOCKER_HOST_IP:8088` 50 | - (experimental) JMX port at `$DOCKER_HOST_IP:9001` 51 | 52 | Run with: 53 | ``` 54 | docker compose -f full-stack.yml up 55 | docker compose -f full-stack.yml down 56 | ``` 57 | 58 | ## Single Kafka (KRaft mode) + Conduktor 59 | 60 | This configuration fits most development requirements. 61 | 62 | - Kafka will be available at `$DOCKER_HOST_IP:9092` 63 | - Conduktor will be available at : `$DOCKER_HOST_IP:8080` 64 | 65 | Run with: 66 | ``` 67 | docker compose -f conduktor-kafka-single.yml up 68 | docker compose -f conduktor-kafka-single.yml down 69 | ``` 70 | 71 | 72 | ## Single Zookeeper / Single Kafka 73 | 74 | This configuration fits most development requirements. 75 | 76 | - Zookeeper will be available at `$DOCKER_HOST_IP:2181` 77 | - Kafka will be available at `$DOCKER_HOST_IP:9092` 78 | - (experimental) JMX port at `$DOCKER_HOST_IP:9999` 79 | 80 | Run with: 81 | ``` 82 | docker compose -f zk-single-kafka-single.yml up 83 | docker compose -f zk-single-kafka-single.yml down 84 | ``` 85 | 86 | ## Single Zookeeper / Multiple Kafka 87 | 88 | If you want to have three brokers and experiment with Kafka replication / fault-tolerance. 89 | 90 | - Zookeeper will be available at `$DOCKER_HOST_IP:2181` 91 | - Kafka will be available at `$DOCKER_HOST_IP:9092,$DOCKER_HOST_IP:9093,$DOCKER_HOST_IP:9094` 92 | 93 | 94 | Run with: 95 | ``` 96 | docker compose -f zk-single-kafka-multiple.yml up 97 | docker compose -f zk-single-kafka-multiple.yml down 98 | ``` 99 | 100 | ## Multiple Zookeeper / Single Kafka 101 | 102 | If you want to have three zookeeper nodes and experiment with zookeeper fault-tolerance. 103 | 104 | - Zookeeper will be available at `$DOCKER_HOST_IP:2181,$DOCKER_HOST_IP:2182,$DOCKER_HOST_IP:2183` 105 | - Kafka will be available at `$DOCKER_HOST_IP:9092` 106 | - (experimental) JMX port at `$DOCKER_HOST_IP:9999` 107 | 108 | Run with: 109 | ``` 110 | docker compose -f zk-multiple-kafka-single.yml up 111 | docker compose -f zk-multiple-kafka-single.yml down 112 | ``` 113 | 114 | 115 | ## Multiple Zookeeper / Multiple Kafka 116 | 117 | If you want to have three zookeeper nodes and three Kafka brokers to experiment with production setup. 118 | 119 | - Zookeeper will be available at `$DOCKER_HOST_IP:2181,$DOCKER_HOST_IP:2182,$DOCKER_HOST_IP:2183` 120 | - Kafka will be available at `$DOCKER_HOST_IP:9092,$DOCKER_HOST_IP:9093,$DOCKER_HOST_IP:9094` 121 | 122 | Run with: 123 | ``` 124 | docker compose -f zk-multiple-kafka-multiple.yml up 125 | docker compose -f zk-multiple-kafka-multiple.yml down 126 | ``` 127 | 128 | # FAQ 129 | 130 | ## Kafka 131 | 132 | **Q: Kafka's log is too verbose, how can I reduce it?** 133 | 134 | A: Add the following line to your docker compose environment variables: `KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"`. Full logging control can be accessed here: https://github.com/confluentinc/cp-docker-images/blob/master/debian/kafka/include/etc/confluent/docker/log4j.properties.template 135 | 136 | **Q: How do I delete data to start fresh?** 137 | 138 | A: Your data is persisted from within the docker compose folder, so if you want for example to reset the data in the full-stack docker compose, do a `docker compose -f full-stack.yml down`. 139 | 140 | **Q: Can I change the zookeeper ports?** 141 | 142 | A: yes. Say you want to change `zoo1` port to `12181` (only relevant lines are shown): 143 | ``` 144 | zoo1: 145 | ports: 146 | - "12181:12181" 147 | environment: 148 | ZOO_PORT: 12181 149 | 150 | kafka1: 151 | environment: 152 | KAFKA_ZOOKEEPER_CONNECT: "zoo1:12181" 153 | ``` 154 | 155 | **Q: Can I change the Kafka ports?** 156 | 157 | A: yes. Say you want to change `kafka1` port to `12345` (only relevant lines are shown). Note only `LISTENER_DOCKER_EXTERNAL` changes: 158 | ``` 159 | kafka1: 160 | image: confluentinc/cp-kafka:7.2.1 161 | hostname: kafka1 162 | ports: 163 | - "12345:12345" 164 | environment: 165 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:12345,DOCKER://host.docker.internal:29092 166 | ``` 167 | 168 | **Q: Kafka is using a lot of disk space for testing. Can I reduce it?** 169 | 170 | A: yes. This is for testing only!!! Reduce the KAFKA_LOG_SEGMENT_BYTES to 16MB and the KAFKA_LOG_RETENTION_BYTES to 128MB 171 | 172 | ``` 173 | kafka1: 174 | image: confluentinc/cp-kafka:7.2.1 175 | ... 176 | environment: 177 | ... 178 | # For testing small segments 16MB and retention of 128MB 179 | KAFKA_LOG_SEGMENT_BYTES: 16777216 180 | KAFKA_LOG_RETENTION_BYTES: 134217728 181 | ``` 182 | 183 | **Q: How do I expose Kafka?** 184 | 185 | A: If you want to expose Kafka outside of your local machine, you must set `KAFKA_ADVERTISED_LISTENERS` to the IP of the machine so that Kafka is externally accessible. To achieve this you can set `LISTENER_DOCKER_EXTERNAL` to the IP of the machine. 186 | For example, if the IP of your machine is `50.10.2.3`, follow the sample mapping below: 187 | 188 | ``` 189 | kafka1: 190 | image: confluentinc/cp-kafka:7.2.1 191 | ... 192 | environment: 193 | ... 194 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:19093,EXTERNAL://50.10.2.3:9093,DOCKER://host.docker.internal:29093 195 | ``` 196 | 197 | **Q: How do I add connectors to Kafka connect?** 198 | 199 | Create a `connectors` directory and place your connectors there (usually in a subdirectory) `connectors/example/my.jar` 200 | 201 | The directory is automatically mounted by the `kafka-connect` Docker container 202 | 203 | OR edit the bash command which pulls connectors at runtime 204 | 205 | ``` 206 | confluent-hub install --no-prompt debezium/debezium-connector-mysql:latest 207 | confluent-hub install 208 | ``` 209 | 210 | **Q: How to disable Confluent metrics?** 211 | 212 | Add this environment variable 213 | ``` 214 | KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false 215 | ``` 216 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2019 Stephane Maarek 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------