The ReplayLogProducer
tool is used to move data from one topic to another.
For this recipe, Kafka must be installed, ZooKeeper running, broker running, and some topics created on it. The topics should have produced some messages. The source topic and the destination topic are required.
From the Kafka installation directory, run this command:
$ bin/kafka-run-class.sh kafka.tools.ReplayLogProducer --sync --broker-list localhost:9092 --inputtopic source-topic --outputtopic good-topic --zookeeper localhost:2181
The ReplayLogProducer
takes the following parameters:
--broker-list <String: hostname:port>
: This is a mandatory parameter. It specifies the broker list.--inputtopic <String: input-topic>
: This is a mandatory parameter. It specifies the source topic.--messages <Integer: count>
: This specifies the number of messages to send. The default value is-1
, meaning infinite.--outputtopic <String: output-topic>...