IT/Kafka

#2. 카프카 실행 시 에러 조치

_하늘여우_ 2020. 7. 14. 22:57

1. 상황

- 카프카 구성 후 실행 시 아래와 같은 에러가 발생하면서 수행이 되지 않는 경우 발생

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Error while executing topic command : Replication factor: 3 larger than available brokers: 0.

 

2. 원인

- 현 테스트 환경은 AWS EC2 프리티어로 구성되어 있음

- AWS EC2의 기본 메모리는 1G인데, 카프카 기동하면서 메모리 1G를 할당하면서 에러 발생

 JVM 메모리 조정으로 해결!

 

3. JVM 메모리 조정 (하기 붉은색으로 수정)

- [root@peter-kafka001 local]# vi /usr/local/kafka/bin/kafka-server-start.sh

- (중략)

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    #메모리 할당 오류로 인한 JVM메모리 조정
    #export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
    export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"
fi

(중략)

→ 힙 메모리 사이즈는 최소 128M, 최대 256M로 설정하므로써 실제 메모리를 벗어나지 않도록 수정함