3

I'm testing kafka's partition reassignment as a precursor to launching a production system. I have several topics with 9 partitions each and a replication factor of 3. I've killed one of the brokers to simulate a failure condition and verified that some topics became under replicated (verification done via a fork of yahoo's kafka manager modified to allow adding a version 0.10.0.1 cluster).

I then started a new broker with a different id. I would now like to distribute partitions to this new broker. I attempted to use kafka manager's reassign partitions functionality however that did not work (possibly due to an improperly modified fork).

I saw that kafka comes with a bin/kafka-reassign-partitions.sh script but the docs say that I have to manually write out the partition reassignments for each topic in json format. Is there a way to handle this without manually deciding on which brokers partitions must go?

1 Answer 1

4

Hmm what a coincidence that I was doing exactly the same thing today. I don't have an answer you're probably going to like but I achieved what I wanted in the end.

Ultimately, what I did was executed the kafka-reassign-partitions command with what the same tool proposed for a reassignment. But whatever it generated I just replaced the new broker id with the old failed broker id. For some reason the generated json moved everything around.

This will fail (or rather never complete) because the old broker has passed on. I then had to delete the reassignment operation in zookeeper (znode: admin/reassign_partitions or something).

Then I restarted kafka on the new broker and it magically picked up as leader of the partition that was looking for a new replacement leader.

I'll let you know if everything is still working tomorrow and if I still have a job ;-)

Sign up to request clarification or add additional context in comments.

7 Comments

You mean you used yahoo's kafka manager to generate the reassignment json?
I used the cli utils - kafka-reassign-partitions (or kafka-reassign-partitions.sh). I installed kafka from homebrew but kafka installations include the utils as well.
I also used Netflix's Exhibitor package for Zookeeper which allows you to view/modify zookeeper znodes. But you can manage Zookeeper via its utils.
Yep I'm using exhibitor as well. I didn't realize the cli tool actually generated the reassignment json, I'll need to read the docs again.
kafka-reassign-partitions --generate --zookeeper zookeeper1:2181/znode --broker-list "id1,id2,id3..." --topics-to-move-json-file somefile.json
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.