It is worth checking the replication factor before modifying:

./path/to/kafka/bin/ --describe --zookeeper localhost:2181 --topic test-topic
Topic:test-topic        PartitionCount:2        ReplicationFactor:1     Configs:
        Topic: demo-topic       Partition: 0    Leader: 0       Replicas: 0     Isr: 0
        Topic: demo-topic       Partition: 1    Leader: 1       Replicas: 1     Isr: 1

It can be seen here that the replication factor is 1.

To update to a replication factor of e.g. 3 firstly create a json file with a new reassignment plan. Call it e.g. reassignment-plan.json:


Now pass this JSON file to Kafka reassign partitions tool script with –execute:

./path/to/kafka/bin/ --zookeeper localhost:2181 --reassignment-json-file reassignment-plan.json --execute

Finally check the replication factor of the topic to confirm replication has been updated:

./path/to/kafka/bin/ --describe --zookeeper localhost:2181 --topic test-topic
Topic:test-topic	PartitionCount:2	ReplicationFactor:3	Configs:
	Topic: test-topic	Partition: 0	Leader: 2	Replicas: 2,1,0	Isr: 2,0,1
	Topic: test-topic	Partition: 1	Leader: 0	Replicas: 0,2,1	Isr: 0,2,1
Written by Matt Cooper
Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: