To change the replication factor of an existing topic, you must perform apartition reassignment, because the replication factor is not directly modifiable via kafka-topics.sh. Thekafka-reassign-partitions.shtool is the official command-line utility to handle partition reassignments, including changing the replication factor.
This tool allows you to generate a reassignment JSON specifying new replica assignments per partition and then apply it.
From official documentation:
“To change the replication factor, use the kafka-reassign-partitions tool to assign the partitions to more or fewer brokers.”
Neither kafka-topics.sh nor kafka-reassign-topics.sh exists for this purpose, and kafka-recreate-topic.sh isnotan official Kafka tool.
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit