카프카 실행 전
docker-compose.yml
version: '2.1'
volumes:
zookeeper-1-data:
zookeeper-1-datalog:
zookeeper-1-logs:
zookeeper-2-data:
zookeeper-2-datalog:
zookeeper-2-logs:
zookeeper-3-data:
zookeeper-3-datalog:
zookeeper-3-logs:
kafka-1-data:
kafka-1-secrets:
kafka-2-data:
kafka-2-secrets:
kafka-3-data:
kafka-3-secrets:
services:
zookeeper-1:
hostname: zookeeper-1
container_name: zookeeper-1
image: zookeeper:3.6
restart: always
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-1-data:/data
- zookeeper-1-datalog:/datalog
- zookeeper-1-logs:/logs
zookeeper-2:
hostname: zookeeper-2
container_name: zookeeper-2
image: zookeeper:3.6
restart: always
ports:
- 2182:2181
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-2-data:/data
- zookeeper-2-datalog:/datalog
- zookeeper-2-logs:/logs
zookeeper-3:
hostname: zookeeper-3
container_name: zookeeper-3
image: zookeeper:3.6
restart: always
ports:
- 2183:2181
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-3-data:/data
- zookeeper-3-datalog:/datalog
- zookeeper-3-logs:/logs
zookeeper-navigator:
hostname: zookeeper-navigator
container_name: zookeeper-navigator
image: elkozmon/zoonavigator:1.1.2
restart: always
ports:
- 9000:9000
environment:
HTTP_PORT: 9000
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
# kafka-1:
# image: confluentinc/cp-kafka:7.1.0
# hostname: kafka-1
# container_name: kafka-1
# ports:
# - 9092:9092
# environment:
# KAFKA_BROKER_ID: 1
# KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-1:9092
# KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
# KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
# BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
# volumes:
# - kafka-1-data:/var/lib/kafka/data
# - kafka-1-secrets:/etc/kafka/secrets
# depends_on:
# - zookeeper-1
# - zookeeper-2
# - zookeeper-3
# kafka-2:
# image: confluentinc/cp-kafka:7.1.0
# hostname: kafka-2
# container_name: kafka-2
# ports:
# - 9093:9093
# environment:
# KAFKA_BROKER_ID: 2
# KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-2:9093
# KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9093
# KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
# BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
# volumes:
# - kafka-2-data:/var/lib/kafka/data
# - kafka-2-secrets:/etc/kafka/secrets
# depends_on:
# - zookeeper-1
# - zookeeper-2
# - zookeeper-3
# kafka-3:
# image: confluentinc/cp-kafka:7.1.0
# hostname: kafka-3
# container_name: kafka-3
# ports:
# - 9094:9094
# environment:
# KAFKA_BROKER_ID: 3
# KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-3:9094
# KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9094
# KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
# BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
# volumes:
# - kafka-3-data:/var/lib/kafka/data
# - kafka-3-secrets:/etc/kafka/secrets
# depends_on:
# - zookeeper-1
# - zookeeper-2
# - zookeeper-3
# kafdrop:
# hostname: kafdrop
# container_name: kafdrop
# image: obsidiandynamics/kafdrop:3.30.0
# ports:
# - 9001:9000
# environment:
# KAFKA_BROKERCONNECT: "kafka-1:9092,kafka-2:9093,kafka-3:9094"
# JVM_OPTS: "-Xms32M -Xmx64M"
# depends_on:
# - zookeeper-1
# - zookeeper-2
# - zookeeper-3
# - kafka-1
# - kafka-2
# - kafka-3
docker-compose up -d
주키퍼 znode 상태
카프카 실행
docker-compose.yml
version: '2.1'
volumes:
zookeeper-1-data:
zookeeper-1-datalog:
zookeeper-1-logs:
zookeeper-2-data:
zookeeper-2-datalog:
zookeeper-2-logs:
zookeeper-3-data:
zookeeper-3-datalog:
zookeeper-3-logs:
kafka-1-data:
kafka-1-secrets:
kafka-2-data:
kafka-2-secrets:
kafka-3-data:
kafka-3-secrets:
services:
zookeeper-1:
hostname: zookeeper-1
container_name: zookeeper-1
image: zookeeper:3.6
restart: always
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-1-data:/data
- zookeeper-1-datalog:/datalog
- zookeeper-1-logs:/logs
zookeeper-2:
hostname: zookeeper-2
container_name: zookeeper-2
image: zookeeper:3.6
restart: always
ports:
- 2182:2181
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-2-data:/data
- zookeeper-2-datalog:/datalog
- zookeeper-2-logs:/logs
zookeeper-3:
hostname: zookeeper-3
container_name: zookeeper-3
image: zookeeper:3.6
restart: always
ports:
- 2183:2181
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zookeeper-1:2888:3888;2181 server.2=zookeeper-2:2888:3888;2181 server.3=zookeeper-3:2888:3888;2181
volumes:
- zookeeper-3-data:/data
- zookeeper-3-datalog:/datalog
- zookeeper-3-logs:/logs
zookeeper-navigator:
hostname: zookeeper-navigator
container_name: zookeeper-navigator
image: elkozmon/zoonavigator:1.1.2
restart: always
ports:
- 9000:9000
environment:
HTTP_PORT: 9000
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
kafka-1:
image: confluentinc/cp-kafka:7.1.0
hostname: kafka-1
container_name: kafka-1
ports:
- 9092:9092
environment:
KAFKA_BROKER_ID: 1
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-1:9092
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
volumes:
- kafka-1-data:/var/lib/kafka/data
- kafka-1-secrets:/etc/kafka/secrets
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
kafka-2:
image: confluentinc/cp-kafka:7.1.0
hostname: kafka-2
container_name: kafka-2
ports:
- 9093:9093
environment:
KAFKA_BROKER_ID: 2
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-2:9093
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9093
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
volumes:
- kafka-2-data:/var/lib/kafka/data
- kafka-2-secrets:/etc/kafka/secrets
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
kafka-3:
image: confluentinc/cp-kafka:7.1.0
hostname: kafka-3
container_name: kafka-3
ports:
- 9094:9094
environment:
KAFKA_BROKER_ID: 3
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-3:9094
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9094
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
BOOTSTRAP_SERVERS: kafka-1:9092,kafka-2:9093,kafka-3:9094
volumes:
- kafka-3-data:/var/lib/kafka/data
- kafka-3-secrets:/etc/kafka/secrets
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
kafdrop:
hostname: kafdrop
container_name: kafdrop
image: obsidiandynamics/kafdrop:3.30.0
ports:
- 9001:9000
environment:
KAFKA_BROKERCONNECT: "kafka-1:9092,kafka-2:9093,kafka-3:9094"
JVM_OPTS: "-Xms32M -Xmx64M"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
- kafka-1
- kafka-2
- kafka-3
docker-compose up -d
znode 확인
'Data Engineering > Kafka' 카테고리의 다른 글
[kafka] 컨슈머 성능 테스트 하는 방법 (0) | 2022.06.17 |
---|---|
[kafka] 프로듀서 성능 테스트 하는 방법 (0) | 2022.06.17 |
[kafka] 주키퍼와 카프카의 모든 볼륨 마운트하기 (0) | 2022.06.17 |
[kafka] 카프카의 메세지는 파티션이 1이면 순서가 보장된다. (0) | 2022.06.12 |
[kafka] 토픽 생성시 --replication-factor --partitions 확인하기 (0) | 2022.06.12 |