(생략...)
Kafka-Docker 레포지토리 주소 에서 먼저 나는 docker-compose-single-broker.yml
로 테스트를 해볼 생각이다.
여기에서 KAFKA_ADVERTISED_HOST_NAME
를 127.0.0.1
로 수정한다.
# docker-compose-single-broker.yml
...
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
...
docker-compose -f docker-compose-single-broker.yml up -d
# Power Shell(관리자 권한으로 실행)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
wsl --install
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
# Microsoft Store에서 Ubuntu 18.04 검색 후 설치
sudo apt update
sudo apt install -y default-jdk
bash -c "cd ~;wget https://archive.apache.org/dist/kafka/2.6.0/kafka_2.13-2.6.0.tgz;tar -xzf kafka_2.13-2.6.0.tgz;rm kafka_2.13-2.6.0.tgz;cd kafka_2.13-2.6.0/;"
vi config/server.properties
#server.property
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://${hostname}:9092
listener.security.protocol.map=PLAINTEXT:PLAINTEXT
md /mnt/c/wsl2_kafka
@echo off^&bash -c "cd ~/kafka_2.13-2.6.0/;sudo bin/kafka-server-stop.sh;sleep 10;sudo bin/zookeeper-server-stop.sh;sleep 10;sudo bin/zookeeper-server-start.sh -daemon config/zookeeper.properties;sleep 30;sudo bin/kafka-server-start.sh -daemon config/server.properties;" > /mnt/c/wsl2_kafka/wsl2_kafka.bat
schtasks /create /ru {username} /rp /sc onstart /tn wsl2_kafka /tr C:\wsl2_kafka\wsl2_kafka.bat /rl highest
cd ~
su
echo "%sudo ALL=NOPASSWD: $(pwd)/kafka_2.13-2.6.0/bin/*" >> /etc/sudoers
# 재실행
shutdown -r -t 0