6.6. Deploying Kafka MirrorMaker


Kafka MirrorMaker replicates data between two or more Kafka clusters, within or across data centers. This process is called mirroring to avoid confusion with the concept of Kafka partition replication. MirrorMaker consumes messages from a source cluster and republishes those messages to a target cluster.

Data replication across clusters supports scenarios that require the following:

  • Recovery of data in the event of a system failure
  • Consolidation of data from multiple source clusters for centralized analysis
  • Restriction of data access to a specific cluster
  • Provision of data at a specific location to improve latency

This procedure shows how to deploy a Kafka MirrorMaker cluster to your OpenShift cluster using the Cluster Operator.

The deployment uses a YAML file to provide the specification to create a KafkaMirrorMaker or KafkaMirrorMaker2 resource depending on the version of MirrorMaker deployed. MirrorMaker 2 is based on Kafka Connect and uses its configuration properties.

重要

Kafka MirrorMaker 1 (referred to as just MirrorMaker in the documentation) has been deprecated in Apache Kafka 3.0.0 and will be removed in Apache Kafka 4.0.0. As a result, the KafkaMirrorMaker custom resource which is used to deploy Kafka MirrorMaker 1 has been deprecated in Streams for Apache Kafka as well. The KafkaMirrorMaker resource will be removed from Streams for Apache Kafka when we adopt Apache Kafka 4.0.0. As a replacement, use the KafkaMirrorMaker2 custom resource with the IdentityReplicationPolicy.

Streams for Apache Kafka provides example configuration files. In this procedure, we use the following example files:

  • examples/mirror-maker/kafka-mirror-maker.yaml
  • examples/mirror-maker/kafka-mirror-maker-2.yaml
重要

If deploying MirrorMaker 2 clusters to run in parallel, using the same target Kafka cluster, each instance must use unique names for internal Kafka Connect topics. To do this, configure each MirrorMaker 2 instance to replace the defaults.

Procedure

  1. Deploy Kafka MirrorMaker to your OpenShift cluster:

    For MirrorMaker:

    oc apply -f examples/mirror-maker/kafka-mirror-maker.yaml

    For MirrorMaker 2:

    oc apply -f examples/mirror-maker/kafka-mirror-maker-2.yaml
  2. Check the status of the deployment:

    oc get pods -n <my_cluster_operator_namespace>

    Output shows the deployment name and readiness

    NAME                                    READY  STATUS   RESTARTS
    my-mirror-maker-mirror-maker-<pod_id>   1/1    Running  1
    my-mm2-cluster-mirrormaker2-<pod_id>    1/1    Running  1

    my-mirror-maker is the name of the Kafka MirrorMaker cluster. my-mm2-cluster is the name of the Kafka MirrorMaker 2 cluster.

    A pod ID identifies each pod created.

    With the default deployment, you install a single MirrorMaker or MirrorMaker 2 pod.

    READY shows the number of replicas that are ready/expected. The deployment is successful when the STATUS displays as Running.

6.6.2. List of Kafka MirrorMaker 2 cluster resources

The following resources are created by the Cluster Operator in the OpenShift cluster:

<mirrormaker2_cluster_name>-mirrormaker2

Name given to the following MirrorMaker 2 resources:

  • StrimziPodSet that creates the MirrorMaker 2 worker node pods.
  • Headless service that provides stable DNS names to the MirrorMaker 2 pods.
  • Service account used by the MirrorMaker 2 pods.
  • Pod disruption budget configured for the MirrorMaker 2 worker nodes.
  • Network Policy managing access to the MirrorMaker 2 REST API.
<mirrormaker2_cluster_name>-mirrormaker2-<pod_id>
Pods created by the MirrorMaker 2 StrimziPodSet.
<mirrormaker2_cluster_name>-mirrormaker2-api
Service which exposes the REST interface for managing the MirrorMaker 2 cluster.
<mirrormaker2_cluster_name>-mirrormaker2-config
ConfigMap which contains the MirrorMaker 2 ancillary configuration and is mounted as a volume by the MirrorMaker 2 pods.
strimzi-<namespace-name>-<mirrormaker2_cluster_name>-mirrormaker2-init
Cluster role binding used by the MirrorMaker 2 cluster.

6.6.3. List of Kafka MirrorMaker cluster resources

The following resources are created by the Cluster Operator in the OpenShift cluster:

<mirrormaker_cluster_name>-mirror-maker

Name given to the following MirrorMaker resources:

  • Deployment which is responsible for creating the MirrorMaker pods.
  • Service account used by the MirrorMaker nodes.
  • Pod Disruption Budget configured for the MirrorMaker worker nodes.
<mirrormaker_cluster_name>-mirror-maker-config
ConfigMap which contains ancillary configuration for MirrorMaker, and is mounted as a volume by the MirrorMaker pods.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部