使用strimzi-kafka-operator 的mirrormake2(mm2)迁移kafka集群,去掉目标集群的topic默认前缀

发布于:2025-02-11 ⋅ 阅读:(28) ⋅ 点赞:(0)

目的

使用mm2进行kafka集群迁移的时候默认配会给target 集群的topic加一个前缀。要想去掉前缀需要使用如下配置添加一条副本策略(replication.policy.class: “org.apache.kafka.connect.mirror.IdentityReplicationPolicy”)。

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaMirrorMaker2
metadata:
  name: my-mirror-maker-2
spec:
  version: 3.9.0
  replicas: 1
  connectCluster: "cluster-b" # Must be the target custer
  clusters:
  - alias: "cluster-a" # Source cluster
    bootstrapServers: cluster-a-kafka-bootstrap:9092
  - alias: "cluster-b" # Target cluster
    bootstrapServers: cluster-b-kafka-bootstrap:9092
    config:
      # -1 means it will use the default replication factor configured in the broker
      config.storage.replication.factor: -1
      offset.storage.replication.factor: -1
      status.storage.replication.factor: -1
  mirrors:
  - sourceCluster: "cluster-a"
    targetCluster: "cluster-b"
    sourceConnector:
      tasksMax: 1
      config:
        # -1 means it will use the default replication factor configured in the broker
        replication.factor: -1
        offset-syncs.topic.replication.factor: -1
        sync.topic.acls.enabled: "false"
        replication.policy.class: "org.apache.kafka.connect.mirror.IdentityReplicationPolicy"
        refresh.topics.interval.seconds: 600
    checkpointConnector:
      tasksMax: 1
      config:
        # -1 means it will use the default replication factor configured in the broker
        checkpoints.topic.replication.factor: -1
        replication.policy.class: "org.apache.kafka.connect.mirror.IdentityReplicationPolicy"
        sync.group.offsets.enabled: "false"
        refresh.groups.interval.seconds: 600
    topicsPattern: ".*"
    groupsPattern: ".*"

网站公告

今日签到

点亮在社区的每一天
去签到