Closed vperi1730 closed 4 years ago
I think that the connectCluster
in your MM2 configuration needs to be the target cluster and not the source cluster. Not sure whether it is or isn't related to the other issues you describe.
Here is the configuration I am using and the connectCluster is pointing to target only.
#Kafka Mirror Maker
kafkammYaml: |-
apiVersion: kafka.strimzi.io/v1alpha1
kind: KafkaMirrorMaker2
metadata:
name: mirrormaker2-test2
spec:
version: 2.4.0
replicas: 1
connectCluster: "my-trgt-cluster"
clusters:
- alias: "my-src-cluster"
authentication:
certificateAndKey:
certificate: user.crt
key: user.key
secretName: user-src
type: tls
bootstrapServers: my-src-cluster-kafka-bootstrap.kafka-mirror-src1.svc:9093
tls:
trustedCertificates:
- certificate: ca.crt
secretName: my-src-cluster-cluster-ca-cert
- alias: "my-trgt-cluster"
authentication:
certificateAndKey:
certificate: user.crt
key: user.key
secretName: user-target
type: tls
bootstrapServers: my-trgt-cluster-kafka-bootstrap.kafka-mirror-trgt1.svc:9093
config:
config.storage.replication.factor: 1
offset.storage.replication.factor: 1
status.storage.replication.factor: 1
tls:
trustedCertificates:
- certificate: ca.crt
secretName: my-trgt-cluster-cluster-ca-cert
mirrors:
- sourceCluster: "my-src-cluster"
targetCluster: "my-trgt-cluster"
sourceConnector:
config:
replication.factor: 1
offset-syncs.topic.replication.factor: 1
sync.topic.acls.enabled: "true"
refresh.groups.enabled: "true"
refresh.topics.enabled: "true"
heartbeatConnector:
config:
heartbeats.topic.replication.factor: 1
checkpointConnector:
config:
checkpoints.topic.replication.factor: 1
topicsPattern: ".*"
groupsPattern: ".*"
This resource MM2 CR is completely different from the previous one. I do not think we can provide any help this way.
Sorry, We were deploying this on 4 diff clusters, hence the CR's are different. Let me check the documentation to see if there is anything I can do before I come back to you.
Thanks Scholzj for your help.
Hi Scholzj, Issue is resolved with the following configuration change. 1 question I have is if I have a topic in src with replication as 1/2/3 these 2 params need to updated in the MM2 every time.
For parameter 18 I made it to 2, so all my topics got auto replicated properly earlier it was replicating only as 1 due to the below configuration. Ask is if i have multiple topics with diff replication factor in src does it support wildcard like * or any other value?
sourceConnector: (17)
config:
replication.factor: 1 (18)
offset-syncs.topic.replication.factor: 1 (19)
I have no idea how they work, sorry.
@vperi1730 The replication.factor
config property defines the initial replication factor for topics that are created by the MM2 MirrorSourceConnector (1), which is useful if you have different numbers of brokers at the target cluster compared to the source cluster. If the topics you want to mirror have various different replication factors you can update them after they have been created by the MirrorSourceConnector (2) or you can create the topics before you start mirroring with replication factors that match those on the source cluster (remember that the mirrored topics include the source cluster alias as a prefix on the topic name, e.g. my-src-cluster.topic1
).
The offset-syncs.topic.replication.factor
config property sets the replication factor for the mm2-offset-syncs.<target-cluster-alias>.internal
topic that is created by the MM2 MirrorSourceConnector (3) on your source cluster. That topic is used to store the offset position that has been reached by the consumer in the MirrorSourceConnector for each mirrored topic-partition. As the offset-syncs topic is created on the source cluster, the offset-syncs.topic.replication.factor
property cannot be larger than the number of brokers on the source cluster.
The MM2 MirrorSourceConnector mirrors topic-level configuration settings across from the source cluster to the target cluster (with a default deny list - see (4)). However, replication factor is not a topic-level configuration setting - see the list at (5).
(1) - https://github.com/apache/kafka/blob/trunk/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.java#L293)) (2) - You can do this via the kafka-reassign-partitions.sh tool, and (I think) Cruise Control can do this for you too. (3) - https://github.com/apache/kafka/blob/trunk/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.java#L281 (4) - https://github.com/apache/kafka/blob/trunk/connect/mirror/src/main/java/org/apache/kafka/connect/mirror/DefaultConfigPropertyFilter.java#L33-L38 (5) - https://kafka.apache.org/documentation.html#topicconfigs
thanks for the information, this helped.
Hi Team,
I have enabled a source and target cluster and MM2 is deployed in the target cluster. Below is the configuration.
Topics in Src Cluster:
As MM2 is up and running in the target, I have noticed some of the topics didn't get replicated and some of them have a replication factor mismatch, I have never seen this behavior earlier, not sure why is this happening. One catch I could see is if the replication factor is >1 it is taking a lot of time however unable to replicate.
Is this anything connected to the Kafka CR configuration or is there any other reason??
Also, test-topic-r2 and mm2-july19-topic which replicated from Src to Target have replication factor count as 1 instead of 2.
My Src Cluster Kafka CR.
Need help on this to resolve.