I build a app and want to connect with kafka. I'm following this code but I got stuck. I couldn't connect with kafka. I've already install kafka, right? and how to run it after that? Please help me!
version: '3.9'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ALLOW_ANONYMOUS_LOGIN: yes
ports:
- 2181:2181
kafka:
image: confluentinc/cp-kafka:latest
depends_on:
- zookeeper
environment:
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
ports:
- 29092:2909
mongodb:
image: mongo:5.0
ports:
- 27017:27017
container_name: mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: NMC
MONGO_INITDB_ROOT_PASSWORD: 123
volumes:
- ./lab2:/home/lab2/data
appchat:
build: .
depends_on:
- zookeeper
- kafka
- mongodb
command: python3 action_server.py
volumes:
- ./lab2:/home/lab2
ports:
- "5000-5000"