Using the MirrorMaker tool
The MirrorMaker tool is useful when we need to replicate the same data in a different cluster. The MirrorMaker tool continuously copies data between two Kafka clusters.
Getting ready
For this recipe, we need two different instances of Kafka running in different clusters. The objective is to replicate the data from one to the other.
How to do it...
From the Kafka installation directory, run this command:
$ bin/kafka-run-class.sh kafka.tools.MirrorMaker --consumer.config config/consumer.config --producer.config config/producer.config --whitelist source-topic
How it works...
The MirrorMaker tool takes the following parameters:
--blacklist <String: Java regex(String)>
: This specifies the blacklist of topics to be mirrored. This can be a regular expression as well.--consumer.config <String: config file>
: This specifies the path to the consumer configuration file to consume from a source cluster. Multiple files may be specified.--help
: This prints the help message...