Reputation: 225
Our setup has one Zookeeper and multiple independent Kafka brokers. We need to programatically create a topic on a specific broker.
We are using AdminUtils to create the topic (after checking if it already exists first). The call looks like this:
AdminUtils.createTopic(zkUtils, topic, partitions = 1, replicationFactor = 1, properties)
"Properties" has only one entry, for the cleanup.policy. The problem with this call is that there is nowhere to specify on which Kafka broker we want the topic created, so Zookeeper picks one and random.
How can I specify the broker for which the topic should be created?
Upvotes: 0
Views: 908
Reputation: 7079
You could reassign the partitions of a topic onto specific brokers using the reassignment tool Kafka ships with. See doc for reference:
Custom partition assignment and migration
Upvotes: 1