![]() |
VOOZH | about |
Kafka MirrorMaker complies with strict certifications, allowing you to keep a replica of your Kafka cluster in a second data center. It accomplishes this by leveraging the existing consumer and producer APIs. Kafka MirrorMaker allows you to copy data across two Kafka clusters. This service allows you to focus on developing your apps rather than worrying about their configuration, monitoring, backup, redundancy, or updates.
Kafka MirrorMaker is a tool for mirroring data across Apache Kafka clusters and it mostly uses the Kafka Connect technology to replicate data, hence increasing resiliency. However, SaaS applications have an extensive deployment across numerous worldwide data centers as this resulted in the development and release of Kafka MirrorMaker 2, which includes additional features. MirrorMaker 2 is used by developers for a variety of applications, such as a communication channel for transferring messages between Kafka clusters in different data centers.
First, you need to ensure files the consumer.properties and producer.properties files are well maintained in Kafka.
consumer.properties:
bootstrap.servers=source_kafka_broker1:9092,source_kafka_broker2:9092
group.id=mirrormaker-consumer-group
key.deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer
value.deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer
producer.properties:
bootstrap.servers=target_kafka_broker1:9092,target_kafka_broker2:9092
key.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
Next, You have to use the below command to create MirrorMaker:
bin/kafka-run-class.sh kafka.tools.MirrorMaker --consumer.config consumer.properties --producer.config producer.properties --whitelist topic1,topic2 --num.streams 4Output:
You can review the logs to keep an eye on the status:
tail -f /path/to/kafka/logs/mirrormaker.logOutput:
At last, the process needs to stop now you have to find the process and stop it:
ps -ef | grep MirrorMakerOutput:
Before you begin Mirror Maker, you should establish any topics that will be mirrored on the destination cluster. Mirror Maker can generate subjects automatically, although they may not have the same configuration as the originals.
If you have many instances, it is advised that they all use the same group in the consumer properties.
In this article, we have learned about Kafka MirrorMaker Management via CLI. Kafka MirrorMaker mirrors data between Apache Kafka clusters. It employs Kafka Connect technology to repeat data, enhancing resilience. However, current SaaS applications require massive deployments across several global data centers.