Install and Run Kafka on my M1 Macbook
M1 맥북 로컬에 카프카를 설치하는 방법은 두가지가 있다. binary 로 다운받아서 설치하는 방법과 간단한 homebrew 를 통해서 설치하는 방법이 있다. homebrew 로 진행해보자.
m1 의 homebrew 통한 설치 경로는 아래와 같다.
- 바이나리와 스크립트는 /opt/homebrew/bin
- Kafka 설정들은 /opt/homebrew/etc/kafka
- Zookeeper 설정은 /opt/homebrew/etc/zookeeper
- log.dirs config (the location for Kafka data) 는 /opt/homebrew/var/lib/kafka-logs
1. homebrew 설치
2. kafka 설치
brew install kafka
3. zookeeper 실행
4. kafka 실행
Zookeeper 없이 실행하기 - Kraft
1. Kafka UUID 생성
kafka-storage random-uuid
# 76BLQI7sT_ql1mBfKsOk9Q
2. 포맷팅
kafka-storage format -t <uuid> -c /opt/homebrew/etc/kafka/kraft/server.properties
# Formatting /opt/homebrew/var/lib/kraft-combined-logs with metadata.version 3.4-IVO.
3. kafka 실행
kafka-server-start /opt/homebrew/etc/kafka/kraft/server.properties
m1 로컬환경에서 kafka broker 를 두 대 이상 띄우기
로컬에서 broker 를 여러대로 클러스터 구성을 하는 방법은 제약사항이 있다. 불가능한 것은 아니고 docker compose 를 사용한다.
대신 아래처럼 hosts 파일에 kafka broker 3개를 등록해야한다.
댓글
댓글 쓰기