본문 바로가기

빅데이터/Kafka

기존에 생성된 compact topic의 cleanup.policy를 변경하는 방법

현재 cleanup.policy 확인

$ ./kafka-topics.sh --bootstrap-server localhost:9092 --topic compact-
test --describe
Topic: compact-test	PartitionCount: 1	ReplicationFactor: 1	Configs: cleanup.policy=compact,segment.bytes=1073741824
	Topic: compact-test	Partition: 0	Leader: 0	Replicas: 0Isr: 0

kafka-configs.sh를 사용하여 토픽 수정

$ ./kafka-configs.sh --bootstrap-server localhost:9092 --alter --entit
y-type topics --entity-name compact-test --add-config cleanup.policy=delete
Completed updating config for topic compact-test.

토픽 변경된 내용 확인

$ ./kafka-topics.sh --bootstrap-server localhost:9092 --topic compact-
test --describe
Topic: compact-test	PartitionCount: 1	ReplicationFactor: 1	Configs: cleanup.policy=delete,segment.bytes=1073741824
	Topic: compact-test	Partition: 0	Leader: 0	Replicas: 0Isr: 0
반응형