Title
Page icon
Create new category
Edit page index title
Edit category
Edit link
Kafka 4 MirrorMaker2
Kafka MirrorMaker2 is integrated with ODP Ambari, and replicates Kafka topics between ODP clusters, allowing data transfer from source to destination and vice versa. Before you configure the Kafka MirrorMaker2 service through Ambari, confirm the health of the Kafka service, including its ability to add and fetch data from topics.
This page describes how to enable Kerberos, SSL, and Ranger authorization for secure access to Kafka service topics, and how to configure and test Kafka4 MirrorMaker2.
Info Kafka MirrorMaker2 on Kafka4 refers to the same MirrorMaker2 on Kafka3, since Kafka3 already supports the MirrorMaker2 architecture.
Enable Kafka Kerberos
Enabling Kerberos for the entire ODP cluster also enables Kerberos for Kafka. For instructions on enabling Kerberos on an ODP cluster, see Enabling Kerberos in an ODP Cluster.
Enable Kafka SSL
Gather the CA-signed truststore and keystore certificates, along with their details, to enable SSL for the Kafka service. If CA certificates aren't accessible, generate self-signed certificates using the steps below.
Replicate the following script on all nodes where Kafka services are running, and run it. Then copy the $(hostname).crt file to all other nodes reciprocally, and import the certificate into the truststore on each node.
With the certificates generated above (or your CA certificates), you're ready to configure Kerberos, SSL, and Ranger for Kafka.
Configure Kerberos, SSL, and Ranger for Kafka
Once you've obtained the Kerberos and SSL details described in the preceding sections, configure them for the Kafka service:
Leave all remaining configurations at their default values. Kafka is now enabled with Ranger, Kerberos, and SSL.
Set up Kafka4 MirrorMaker2 with Kerberos and SSL
MirrorMaker2 supports multiple topologies. This page covers one topology, consisting of one source cluster and one destination cluster.
Step 1: Navigate to the Kafka MirrorMaker2 configuration
Sign in to the Ambari UI.
In the main menu, go to the Services list, and select Kafka from the list of services to open the Kafka service page.
On the Kafka service page, select the Configs tab.
Go to the Advanced section, and find the subsection titled Advanced kafka-mirrormaker2.
Modify and save the configuration at Mirror-Maker2 Template.
Step 2: Configure the Mirror-Maker2 Template
This example uses a replication factor of 1 because it's based on a test cluster. If your Kafka clusters consist of 3 or more nodes, set the replication factor to a minimum of 3.
Test the MirrorMaker2 use case
The following topics are replicated from the source cluster to the destination cluster, each appended with .Dest:
In the destination cluster, you can see the following default topics, each appended with the name of the source cluster:
Replicate a topic from the source to the destination cluster
Step 1: Produce data on the source cluster
Produce data for your topic using the Kafka console producer. Connect to your source cluster and specify the topic and security configurations:
Add sample data:
Step 2: Verify from the destination cluster
Confirm that the topic replicated to the destination cluster. Use the Kafka topics command to list topics and verify the presence of your source topic:
Expected output:
Step 3: Consume data from the replicated cluster
Use the Kafka console consumer to view the data from the replicated topic and confirm successful replication:
Expected output:
Step 4: Manage multiple topics
Add several topics from the source cluster, and verify their presence in the destination cluster. The topics appear in the destination cluster's topic list with a prefix that includes the source cluster's name. This lets you distinguish between locally created topics and replicated ones.