본문 바로가기
kafka/core

카프카 환경 파라미터의 구분 및 kafka-configs 명령어로 파라미터 검색 및 수정

by 개복이 2025. 4. 27.

카프카 환경 파라미터의 구분 및 kafka-configs 명령어로 파라미터 검색 및 수정

Kafka Config 구분 및 이해

Config 구분 설명
Broker와 Topic 레벨 Config - Kafka 서버에서 설정되는 Config
- Topic의 Config 값은 Broker 레벨에서 지정한 Config를 기본으로 설정하여 별도의 Topic 레벨 Config를 설정할 경우 이를 따른다.
- 보통 server.properties에 있는 Config는 변경 시 Broker 재기동이 필요한 Static Config이며, Dynamic Config는 kafka-configs를 이용하여 동적으로 Config 변경이 가능하다.
Producer와 Consumer 레벨 Config - Kafka 클라이언트에서 설정되는 Config
- Client 레벨에서 설정되므로 server.properties에 존재하지 않고, kafka-configs로 수정할 수 없으며 Client 수행 시마다 설정할 수 있다.

 

kafka-configs 사용

Config 구분 사용법
Config 값 확인 kafka-configs --bootstrap-server [hostip:port] --entity-type [brokers/topics] --entity-name [broker id/topic name] --all --describe
Config 값 설정 kafka-configs --bootstrap-server [hostip:port] --entity-type [brokers/topics] --entity-name [broker id/topic name] --alter --add-config property명=value
Config 값 Unset kafka-configs --bootstrap-server [hostip:port] --entity-type [brokers/topics] --entity-name [broker id/topic name] --alter --delete-config property명

 

/bin 경로에 kafka-configs 확인

 

Broker의 Config 확인

kafka-configs --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --all --describe

 

grep을 통해 특정 Config 확인

kafka-configs --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --all --describe | grep message

 

Topic의 Config 확인

kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --all --describe

 

grep을 통해 특정 Config 확인

kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --all --describe | grep max.message

 

Topic의 Config 변경

max.message.bytes 확인

  • max.message.bytes의 기본 값은 1048588인 것을 확인할 수 있다.
kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --all --describe | grep max.message.bytes

 

max.message.bytes 값 변경

  • max.message.bytes를 2088000으로 변경
kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --alter --add-config max.message.bytes=2088000

 

max.message.bytes 값 변경 후 확인

  • max.message.bytes 값이 2088000으로 변경된 것을 확인할 수 있다.
kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --all --describe | grep max.message.bytes

 

max.message.bytes 기본 값으로 초기화

kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --alter --delete-config max.message.bytes

 

max.message.bytes 기본 값으로 초기화 후 확인

  • max.message.bytes 값이 1048588으로 기본 값으로 초기화된 것을 확인할 수 있다.
kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name multipart-topic --all --describe | grep max.message.bytes

댓글