This topic describes how to use MirrorMaker to migrate data in a user-created Kafka cluster to a Message Queue for Apache Kafka instance.
Prerequisites
Background information
Kafka mirroring can be used to back up data in Kafka clusters. MirrorMaker is the tool to implement this feature. You can use MirrorMaker to mirror the source user-created Kafka cluster to the destination cluster. The destination cluster is a Message Queue for Apache Kafka instance, as shown in the following figure. MirrorMaker uses a built-in consumer to consume messages from the user-created Kafka cluster and then uses a built-in producer to send these messages to the Message Queue for Apache Kafka instance.

Fore more information, see Apache Kafka MirrorMaker.
Precautions
- The topic names of the source and destination clusters must be consistent.
- The numbers of partitions of the source and destination clusters can be different.
- Data in the same partition may not be distributed to the same partition.
- By default, messages with the same key are distributed to the same partition.
- Normal messages may be out of order when the instance fails, whereas partitionally ordered messages remain in order when the instance fails.
Access from a VPC
Access from the Internet
Verify the result
You can check whether MirrorMaker runs by using one of the following methods:
- Run
kafka-consumer-groups.sh
to view the consumption progress of the user-created cluster.bin/kafka-consumer-groups.sh --new-consumer --describe --bootstrap-server endpoint of the user-created cluster --group test-consumer-group
- Send messages to the user-created cluster. In the Message Queue for Apache Kafka console, check the partition status of the topic, and check whether the total number of messages in the current broker is correct. You can view the specific content of a message in the Message Queue for Apache Kafka console. For more information, see Query messages.