MirrorMaker 2

A second Kafka cluster beside the first, a MirrorMaker 2 that copies the event catalog's topics and the consumer group offsets from one to the other, and a consumer that fails over by changing its bootstrap address and resumes from the translated offset.

Chapter 34

examples/34-mirrormaker-2/ is a manifest overlay on the shared minikube setup in examples/_k8s: the Kafka cluster edp, a second cluster edp-dr with one dual-role node, a KafkaMirrorMaker2 from edp to edp-dr, the Strimzi monitoring, and the order-service and notification-service. It accompanies MirrorMaker 2.

It uses kustomize through kubectl, Strimzi, Kafka, CloudNativePG, the LGTM image and the unchanged order-service and notification-service images.

cd examples/34-mirrormaker-2
./verify.sh
A record at source offset 4 gets an offset sync, the group commits 4 on the source and is stopped, a checkpoint carries the translated offset, the group on the target is written with 4, and a consumer with a new bootstrap address reads from 4
How a source group offset becomes a target group offset

What to observe

  1. The same names. edp.orders.placed exists on both clusters, with the same number of records, and the offset syncs and checkpoints sit in the internal topics the connectors use.
  2. A group on the copy. The group notification-service appears on edp-dr with the committed offsets it has on edp, before any consumer there has joined.
  3. A failover that changes one setting. notification-service is stopped, five more orders arrive, and the service started against edp-dr reads exactly those five.
  4. A witness. With OFFSET_SYNC=off the group never appears on edp-dr.

Infrastructure

The cluster, PostgreSQL, LGTM, metrics and monitoring bases of examples/_k8s, the second cluster and the mirror, one dashboard, and the order-service and notification-service deployments.