docker-compose.yml
version: '2.1'
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:
- type: bind
source: ./data/zk-cluster/zookeeper-1/data
target: /data
read_only: false
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:
- type: bind
source: ./data/zk-cluster/zookeeper-2/data
target: /data
read_only: false
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:
- type: bind
source: ./data/zk-cluster/zookeeper-3/data
target: /data
read_only: false
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
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
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
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
docker-compose up -d
docker exec -it kafka-1 bash
kafka-topics --list --bootstrap-server kafka-1:9092,kafka-2:9093,kafka-3:9094
kafka-topics --list --bootstrap-server kafka-1:9092
kafka-topics --list --bootstrap-server kafka-2:9093
kafka-topics --list --bootstrap-server kafka-3:9094
kafka-topics --create --bootstrap-server kafka-1:9092,kafka-2:9093,kafka-3:9094 --replication-factor 1 --partitions 1 --topic mytopic
kafka-topics --create --bootstrap-server kafka-1:9092 --replication-factor 1 --partitions 1 --topic topic-kafka-1
kafka-topics --create --bootstrap-server kafka-2:9093 --replication-factor 1 --partitions 1 --topic topic-kafka-2
kafka-topics --create --bootstrap-server kafka-3:9094 --replication-factor 1 --partitions 1 --topic topic-kafka-3
kafka-topics --list --bootstrap-server kafka-1:9092,kafka-2:9093,kafka-3:9094
kafka-topics --list --bootstrap-server kafka-1:9092
kafka-topics --list --bootstrap-server kafka-2:9093
kafka-topics --list --bootstrap-server kafka-3:9094
kafka-topics --delete --bootstrap-server kafka-1:9092,kafka-2:9093,kafka-3:9094 --topic mytopic,topic-kafka-1,topic-kafka-2,topic-kafka-3
kafka-topics --list --bootstrap-server kafka-1:9092,kafka-2:9093,kafka-3:9094
'Data Engineering > Kafka' 카테고리의 다른 글
[kafka] 토픽 생성시 --replication-factor --partitions 확인하기 (0) | 2022.06.12 |
---|---|
[kafka] Error while executing topic command : Replication factor: 4 larger than available brokers: 3. (0) | 2022.06.12 |
[Kafka] 카프카 클러스터 만들기 (confluentinc/cp-kafka:7.1.0) (0) | 2022.06.08 |
[Zookeeper] 주키퍼에 특정 znode에 어떤 znode가 들어있는지 확인하는 방법 (0) | 2022.06.08 |
[Zookeeper] 주키퍼에 어떤 znode가 들어있는지 확인하는 방법 (0) | 2022.06.08 |