Apache Kafka KRaft λ‘컬 μ€μΉ
Apache Kafkaμ λν νμ΅μ μν΄ λ컀 μ»΄ν¬μ¦λ‘ μΉ΄νμΉ΄μ λν νκ²½μ ꡬμ±ν λ λλΆλΆ wurstmeister/kafka-docker λλ confluentinc/cp-kafka μ¬μ©νμ¬ ZooKeeper κΈ°λ°μ μΉ΄νμΉ΄λ₯Ό μ€ννλ λ°©λ²μ λν΄ μ€λͺ νλ κ²μ λ³Ό μ μλ€. λ³Έ κΈμμλ 컨ν루μΈνΈμμ μ 곡νλ confluentinc/confluent-localλ₯Ό μ¬μ©ν΄ KRaft λͺ¨λμ Apache Kafkaμ λν νμ΅ νκ²½μ λ§λλ κ²μ 곡μ νκ³ μ νλ€.
λ컀 μ»΄ν¬μ¦ λ¬Έμ μμ±
version: '3'
services:
kafka:
image: confluentinc/confluent-local:7.5.6
hostname: kafka
container_name: kafka
ports:
- "9092:9092"
- "8082:8082"
environment:
CLUSTER_ID: "EaJs_OcfTB6oWCOPTuY64Q"
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:29093"
KAFKA_INTER_BROKER_LISTENER_NAME: "PLAINTEXT"
KAFKA_LISTENERS: "PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092"
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT"
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092"
KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs"
KAFKA_REST_HOST_NAME: rest-proxy
KAFKA_REST_BOOTSTRAP_SERVERS: "kafka:29092"
KAFKA_REST_LISTENERS: "http://0.0.0.0:8082"
kafka-ui: # Optional
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- "8080:8080"
depends_on:
- kafka
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
KAFKA_CLUSTERS_0_AUDIT_TOPICAUDITENABLED: 'true'
KAFKA_CLUSTERS_0_AUDIT_CONSOLEAUDITENABLED: 'true'
confluent-local μ΄λ―Έμ§λ κ°λ° νκ²½μ μν κ²μ΄λ―λ‘ νλ‘λμ νκ²½μμλ cp-all-in-one-kraft λ₯Ό μ°Έκ³ ν΄μ cp-kafka λ‘ μ§μ ꡬμ±ν΄μΌν©λλ€.
Kafka ν΄λ¬μ€ν° μμ΄λ
kafka-storageλ‘ μΉ΄νμΉ΄μμ μ¬μ©ν ν΄λ¬μ€ν° μμ΄λλ₯Ό λ§λ€μ΄μΌνλ©° kafka-storage λ confluent-local μ΄λ―Έμ§μ ν¬ν¨λμ΄ μμ΄ μλμ κ°μ΄ λͺ λ Ήμ΄λ₯Ό μ€ννμ¬ μμ±ν μ μλ€. How to generate Kafka cluster ID μμλ kafka-storage λ₯Ό μ¬μ©νμ§ μκ³ λ Base64λ‘ μΈμ½λ©λ UUIDλ₯Ό λ§λλ λ°©λ²μ λν΄μ μλ €μ£Όκ³ μμΌλ μ°Έκ³ νλ©΄ μ’κ² λ€.
# docker run --rm confluentinc/confluent-local:7.5.6 /bin/sh -c "/bin/uuidgen --time | tr -d '-' | base64 | cut -b 1-22"
docker run --rm confluentinc/confluent-local:7.5.6 /bin/kafka-storage random-uuid
EaJs_OcfTB6oWCOPTuY64Q