Obsidian/Recognition/Work Related/1.업무메모/2023-05-08.md

167 lines
4.5 KiB
Markdown

-- kafka-ui 설치
``` shell
version: '3.8'
services:
zookeeper2:
image: confluentinc/cp-zookeeper:latest
restart: unless-stopped
hostname: zookeeper2
container_name: zookeeper2
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: datanode1:2888:3888;zookeeper2:2888:3888;zookeeper3:22888:33888
ZOOKEEPER_MAX_CLIENT_CNXNS: 60
#ZOOKEEPER_DATA_DIR: /var/lib/zookeeper2
#LOG_DIR: /var/log/zookeeper2
volumes:
- "~/zk-cluster/zookeeper2/data:/data"
#network_mode: host
networks:
- kafka-cluster-net
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
zookeeper3:
image: confluentinc/cp-zookeeper:latest
restart: unless-stopped
hostname: zookeeper3
container_name: zookeeper3
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
environment:
ZOOKEEPER_SERVER_ID: 3
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: datanode1:2888:3888;zookeeper2:2888:3888;zookeeper3:22888:33888
ZOOKEEPER_MAX_CLIENT_CNXNS: 60
#ZOOKEEPER_DATA_DIR: /var/lib/zookeeper2
#LOG_DIR: /var/log/zookeeper2
volumes:
- "~/zk-cluster/zookeeper3/data:/data"
#network_mode: host
networks:
- kafka-cluster-net
ports:
- "2182:2181"
- "22888:22888"
- "33888:33888"
kafka2:
image: confluentinc/cp-kafka:latest
restart: unless-stopped
hostname: kafka2
container_name: kafka2
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
environment:
KAFKA_BROKER_ID: 2
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9091
KAFKA_ZOOKEEPER_CONNECT: "datanode1:2181,zookeeper2:2181,zookeeper3:2181"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://118.220.143.176:9091
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
KAFKA_NUM_PARTITIONS: 1
KAFKA_LOG4J_LOGGERS: "kafka.authorizer.logger=INFO"
KAFKA_LOG4J_ROOT_LOGLEVEL: INFO
KAFKA_DATA_DIR: ~/kafka2
#KAFKA_LOG_RETENTION_HOURS: 168
#LOG_DIR: /var/log/kafka
depends_on:
- zookeeper2
- zookeeper3
#network_mode: host
networks:
- kafka-cluster-net
ports:
- "9091:9091"
kafka3:
image: confluentinc/cp-kafka:latest
restart: unless-stopped
hostname: kafka3
container_name: kafka3
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
environment:
KAFKA_BROKER_ID: 3
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ZOOKEEPER_CONNECT: "datanode1:2181,zookeeper2:2181,zookeeper3:2181"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://118.220.143.176:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
KAFKA_NUM_PARTITIONS: 1
KAFKA_LOG4J_LOGGERS: "kafka.authorizer.logger=INFO"
KAFKA_LOG4J_ROOT_LOGLEVEL: INFO
#KAFKA_DATA_DIR: /var/lib/kafka
#KAFKA_LOG_RETENTION_HOURS: 168
#LOG_DIR: /var/log/kafka
depends_on:
- zookeeper2
- zookeeper3
#network_mode: host
networks:
- kafka-cluster-net
ports:
- "9092:9092"
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
depends_on:
- kafka2
- kafka3
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
ports:
- "9900:8080"
restart: "no"
environment:
- KAFKA_CLUSTERS_0_NAME=test-kafka-cluster
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=datanode1:9091,datanode2:9091,datanode3:9092
kafdrop:
image: obsidiandynamics/kafdrop:latest
hostname: kafdrop
container_name: kafdrop
extra_hosts:
- "datanode1:118.220.143.175"
- "datanode2:118.220.143.176"
- "datanode3:118.220.143.176"
environment:
- KAFKA_BROKERCONNECT=datanode1:9091,datanode2:9091,datanode3:9092
depends_on:
- kafka2
networks:
- kafka-cluster-net
ports:
- "9000:9000"
networks:
kafka-cluster-net:
name: kafka-cluster-net
driver: bridge
```