我正在尝试在2个群集之间设置复制,但不希望更改主题名称。例如,如果我有一个名为“some_topic”的主题,它将自动复制到“cluster1.some_topic”,我很确定可以做到这一点,但没有找到正确的配置来更改此设置
我当前的配置“mirrormaker2.properties”
# Sample MirrorMaker 2.0 top-level configuration file
# Run with ./bin/connect-mirror-maker.sh connect-mirror-maker.properties
# specify any number of cluster aliases
clusters = cluster1, cluster2
# connection information for each cluster
cluster1.bootstrap.servers = host1:9092,host2:9092,host3:9092
cluster2.bootstrap.servers = rep_host1:9092,rep_host2:9092,rep_host3:9092
# enable and configure individual replication flows
cluster1->cluster2.enabled = true
cluster1->cluster2.topics = sometopic.*
# customize as needed
# replication.policy.separator = _
# sync.topic.acls.enabled = false
# emit.heartbeats.interval.seconds = 5
以供引用:
最佳答案
我认为以上答案不合适。
在Mirror Maker 2.0中,如果要保持主题不变,则必须实现ReplicationPolicy。
您可以引用DefaultReplicationPolicy.class,然后覆盖formatRemoteTopic()
,之后您必须删除sourceClusterAlias + separator
。最后,在replication.policy.class
中配置mm2.properties
我定义了MigrationReplicationPolicy.class
replication.policy.class = org.apache.kafka.connect.mirror.MigrationReplicationPolicy
您应该看到
MirrorClientConfig,class
,我知道您会明白的
关于apache-kafka - 是否可以使用MirrorMaker2复制没有别名前缀的kafka主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59390555/