diff --git a/2024/08/chat_demo1/tools/README.md b/2024/08/chat_demo1/tools/README.md new file mode 100644 index 0000000..772d799 --- /dev/null +++ b/2024/08/chat_demo1/tools/README.md @@ -0,0 +1,3 @@ +# Kafka docker setup + +Seems like there is a behavior change between 7.4.4 and latest (7.8.0, too) images. The same config works for 7.4.4 but not for the latest (it tries to connect broker and it fails). diff --git a/2024/08/chat_demo1/tools/docker-compose.yaml b/2024/08/chat_demo1/tools/docker-compose.yaml index 9b2f3c4..c3a75c8 100644 --- a/2024/08/chat_demo1/tools/docker-compose.yaml +++ b/2024/08/chat_demo1/tools/docker-compose.yaml @@ -1,20 +1,22 @@ services: - broker: - image: apache/kafka:latest - container_name: broker + zookeeper: + image: confluentinc/cp-zookeeper:7.5.0 environment: - KAFKA_NODE_ID: 1 - KAFKA_PROCESS_ROLES: broker,controller - KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://:9092 - KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - KAFKA_CONTROLLER_QUORUM_VOTERS: 1@:9093 - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 - KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 - KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 - KAFKA_NUM_PARTITIONS: 3 + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 ports: - - "9092:9092" - - "9093:9093" \ No newline at end of file + - "22181:2181" + broker: + image: confluentinc/cp-kafka:7.5.0 + depends_on: + - zookeeper + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + ports: + - "29092:29092" + diff --git a/2024/08/chat_demo1/tools/docker-compose.yaml.bak b/2024/08/chat_demo1/tools/docker-compose.yaml.bak new file mode 100644 index 0000000..2ba8c8c --- /dev/null +++ b/2024/08/chat_demo1/tools/docker-compose.yaml.bak @@ -0,0 +1,21 @@ +services: + zookeeper: + image: confluentinc/cp-zookeeper:latest + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + ports: + - '2181:2181' + broker: + image: confluentinc/cp-kafka:latest + depends_on: + - zookeeper + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + ports: + - "29092:29092" diff --git a/2024/08/chat_demo1/tools/docker-compose.yaml.bak.2 b/2024/08/chat_demo1/tools/docker-compose.yaml.bak.2 new file mode 100644 index 0000000..4c76793 --- /dev/null +++ b/2024/08/chat_demo1/tools/docker-compose.yaml.bak.2 @@ -0,0 +1,23 @@ +version: '2' +services: + zookeeper: + image: confluentinc/cp-zookeeper:7.4.4 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + ports: + - 22181:2181 + + kafka: + image: confluentinc/cp-kafka:7.4.4 + depends_on: + - zookeeper + ports: + - 29092:29092 + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 diff --git a/2024/08/chat_demo1/tools/docker-compose.yaml.bak.3 b/2024/08/chat_demo1/tools/docker-compose.yaml.bak.3 new file mode 100644 index 0000000..1ab0253 --- /dev/null +++ b/2024/08/chat_demo1/tools/docker-compose.yaml.bak.3 @@ -0,0 +1,22 @@ +services: + zookeeper: + image: confluentinc/cp-zookeeper:7.4.4 + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + ports: + - "22181:2181" + broker: + image: confluentinc/cp-kafka:7.4.4 + depends_on: + - zookeeper + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:9092,PLAINTEXT_HOST://localhost:29092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + ports: + - "29092:29092" +