Skip to content

Sync Kafka consumer group settings

What can be carried over for a consumer group, and what Kafka simply cannot hold.

Terminal recording of kurkik kafka sync

The recording shows kurkik kafka sync on the demo sandbox; its data differs from this example.

Shown here: one broker. Other broker setups are further down.

Nothing changes yet. --dry-run only shows what would happen.

$ kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run
Sync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qk
owns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (3)
~ set group audit consumer.heartbeat.interval.ms (not set) -> 6000
Group audit is not on the cluster: Kafka keeps its settings by id, and the group appears when a consumer joins it, with no committed positions.
~ set group notifier consumer.session.timeout.ms (default) -> 50000
- delete group legacy-report [deletes the group's committed positions]
legacy-report's 1 committed position(s) go with it; the rollback commits them again. Its own settings stay with Kafka.
note: Group sync: Kafka holds no group without members or committed positions. A group the document describes is made by writing its own settings, which Kafka keeps by the group's id; the group itself appears only when a consumer joins it, and starts with no committed positions - its consumers begin where auto.offset.reset says. No position is ever copied from the document's cluster. A group with nothing of its own to write cannot be made at all. With --delete, empty groups the document does not describe are deleted with their positions; the rollback commits those again (Kafka then makes it a classic group until a consumer of another protocol joins).
left alone (10)
not decided customers.updated groupId
Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_customers.updated' declares no consumer group, so there is nothing a broker could confirm.
not decided customers.updated action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'customers.updated', so operation 'send_customers.updated' is not checked.
not decided orders.created action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked.
not decided payments.settled action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked.
not held group audit groupId
Kafka keeps no group without members or committed positions, so audit itself is not made: its own settings are written (below), and it appears when a consumer joins it, with no committed positions.
not held group billing groupId
Kafka keeps no group without members or committed positions, and billing sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
in use group invoicing groupId
invoicing has 1 member(s) connected. sync deletes only a group nobody is in.
not held group nightly-report groupId
Kafka keeps no group without members or committed positions, and nightly-report sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
and 2 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; ALTER_CONFIGS on GROUP audit; ALTER_CONFIGS on GROUP notifier; DELETE on GROUP legacy-report
3 changes, 1 destroy - 1 still differs
rehearsal
[?] not attempted delete group legacy-report
not rehearsed: it has no validate-only form
[+] done set group audit consumer.heartbeat.interval.ms (not set) -> 6000
[+] done set group notifier consumer.session.timeout.ms (default) -> 50000
The cluster would accept every request it was shown. 1 could not be rehearsed - Kafka has no validate-only deletion or ACL change, and a schema registry no validate-only write. Nothing was changed.
exit 2
$ kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --yes
Sync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qk
owns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (3)
~ set group audit consumer.heartbeat.interval.ms (not set) -> 6000
Group audit is not on the cluster: Kafka keeps its settings by id, and the group appears when a consumer joins it, with no committed positions.
~ set group notifier consumer.session.timeout.ms (default) -> 50000
- delete group legacy-report [deletes the group's committed positions]
legacy-report's 1 committed position(s) go with it; the rollback commits them again. Its own settings stay with Kafka.
note: Group sync: Kafka holds no group without members or committed positions. A group the document describes is made by writing its own settings, which Kafka keeps by the group's id; the group itself appears only when a consumer joins it, and starts with no committed positions - its consumers begin where auto.offset.reset says. No position is ever copied from the document's cluster. A group with nothing of its own to write cannot be made at all. With --delete, empty groups the document does not describe are deleted with their positions; the rollback commits those again (Kafka then makes it a classic group until a consumer of another protocol joins).
left alone (10)
not decided customers.updated groupId
Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_customers.updated' declares no consumer group, so there is nothing a broker could confirm.
not decided customers.updated action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'customers.updated', so operation 'send_customers.updated' is not checked.
not decided orders.created action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked.
not decided payments.settled action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked.
not held group audit groupId
Kafka keeps no group without members or committed positions, so audit itself is not made: its own settings are written (below), and it appears when a consumer joins it, with no committed positions.
not held group billing groupId
Kafka keeps no group without members or committed positions, and billing sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
in use group invoicing groupId
invoicing has 1 member(s) connected. sync deletes only a group nobody is in.
not held group nightly-report groupId
Kafka keeps no group without members or committed positions, and nightly-report sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
and 2 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; ALTER_CONFIGS on GROUP audit; ALTER_CONFIGS on GROUP notifier; DELETE on GROUP legacy-report
3 changes, 1 destroy - 1 still differs
applied
[+] done set group audit consumer.heartbeat.interval.ms (not set) -> 6000
[+] done set group notifier consumer.session.timeout.ms (default) -> 50000
[+] done delete group legacy-report
Applied 3 of 3 changes - 10 left alone
snapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
rollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yaml
undo: kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
exit 2

Written before the first change.

rollback.yaml
system: "Apache Kafka"
target: "MkU3OEVBNTcwNTJENDM2Qk"
createdAt: "<time>"
document: "~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml"
entries:
- forAction: "set-setting:audit:consumer.heartbeat.interval.ms"
undo: "REMOVE_SETTING_OVERRIDE"
target: "audit"
field: "consumer.heartbeat.interval.ms"
preState:
override: false
note: "The system had no setting of its own here, so undoing means removing one."
definition:
scope: "GROUP"
- forAction: "set-setting:notifier:consumer.session.timeout.ms"
undo: "REMOVE_SETTING_OVERRIDE"
target: "notifier"
field: "consumer.session.timeout.ms"
preState:
override: false
note: "The system had no setting of its own here, so undoing means removing one."
definition:
scope: "GROUP"
- forAction: "delete-group:legacy-report"
undo: "RESTORE_DELETED_GROUP"
target: "legacy-report"
note: "sync deleted this group. Its committed positions can be committed again;\
\ it comes back with nobody in it."
definition:
groupId: "legacy-report"
groupType: "classic"
offset.0.orders.created: "0"

Download rollback.yaml

$ kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes
Revert b to b-<time>.snapshot.yaml - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qk
owns: what the run being undone changed, as its rollback records it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (3)
+ restore group legacy-report
Commits 1 position(s) of legacy-report again. Kafka makes such a group a classic one until a consumer of another protocol joins it.
~ unset group notifier consumer.session.timeout.ms 50000 -> (default)
~ unset group audit consumer.heartbeat.interval.ms 6000 -> (default)
note: Group sync: Kafka holds no group without members or committed positions. A group the document describes is made by writing its own settings, which Kafka keeps by the group's id; the group itself appears only when a consumer joins it, and starts with no committed positions - its consumers begin where auto.offset.reset says. No position is ever copied from the document's cluster. A group with nothing of its own to write cannot be made at all. With --delete, empty groups the document does not describe are deleted with their positions; the rollback commits those again (Kafka then makes it a classic group until a consumer of another protocol joins).
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; READ on GROUP legacy-report and on the topics it read; ALTER_CONFIGS on GROUP notifier; ALTER_CONFIGS on GROUP audit
3 changes
applied
[+] done restore group legacy-report
[+] done unset group notifier consumer.session.timeout.ms 50000 -> (default)
[+] done unset group audit consumer.heartbeat.interval.ms 6000 -> (default)
Applied 3 of 3 changes
snapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
rollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yaml
undo: kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
exit 0

After the revert, compared with how it was before: Drift: 0 changed · 0 unmanaged · 0 missing (no drift) - 42 matched

source.yaml, 232 lines
asyncapi: 3.0.0
info:
title: a Apache Kafka API
version: 1.0.0-SNAPSHOT
description: "Generated by reading the a cluster. Cluster id: MkU3OEVBNTcwNTJENDM2Qk."
servers:
broker-1:
host: a-kafka-1:9092
protocol: kafka
protocolVersion: "4.4"
x-kurkik:
kafka:
server:
security:
- security: PLAINTEXT
securityProtocol: PLAINTEXT
acl: []
groups:
- groupId: audit
groupType: consumer
state: STABLE
clientIds:
- audit-1
topics:
- orders.created
configuration:
consumer.heartbeat.interval.ms: "6000"
- groupId: billing
groupType: classic
state: STABLE
clientIds:
- billing-1
topics:
- orders.created
- payments.settled
configuration: {}
- groupId: nightly-report
groupType: classic
state: EMPTY
clientIds: []
topics:
- orders.created
configuration: {}
- groupId: notifier
groupType: consumer
state: STABLE
clientIds:
- notifier-1
topics:
- payments.settled
configuration:
consumer.session.timeout.ms: "50000"
brokerConfiguration:
advertised.listeners: "INTERNAL://kafka-1:19092,EXTERNAL://a-kafka-1:9092"
authorizer.class.name: org.apache.kafka.metadata.authorizer.StandardAuthorizer
broker.id: "1"
controller.listener.names: CONTROLLER
controller.quorum.voters: 1@kafka-1:9093
group.initial.rebalance.delay.ms: "0"
inter.broker.listener.name: INTERNAL
listener.security.protocol.map: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
listeners: "INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093"
min.insync.replicas: "1"
node.id: "1"
offsets.topic.replication.factor: "1"
process.roles: "broker,controller"
transaction.state.log.min.isr: "1"
transaction.state.log.replication.factor: "1"
clientConfiguration:
bootstrap.servers: a-kafka-1:9092
security.protocol: PLAINTEXT
groupConfiguration: {}
producerConfiguration: {}
consumerConfiguration: {}
channels:
customers.updated:
address: customers.updated
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy:
- compact
x-kurkik:
kafka:
channel:
topic: customers.updated
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy: compact
orders.created:
address: orders.created
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: 604800000
x-kurkik:
kafka:
channel:
topic: orders.created
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: "604800000"
payments.settled:
address: payments.settled
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
x-kurkik:
kafka:
channel:
topic: payments.settled
partitions: 3
replicas: 1
topicConfiguration:
min.insync.replicas: "1"
retention.bytes: "10737418240"
operations:
receive_customers.updated:
action: receive
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security: []
consumerConfiguration: {}
groupConfiguration: {}
receive_orders.created:
action: receive
channel:
$ref: "#/channels/orders.created"
bindings:
kafka:
bindingVersion: 0.5.0
groupId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- audit
- billing
- nightly-report
clientId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- audit-1
- billing-1
x-kurkik:
kafka:
operation:
groupId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- audit
- billing
- nightly-report
clientId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- audit-1
- billing-1
security: []
consumerConfiguration: {}
groupConfiguration: {}
receive_payments.settled:
action: receive
channel:
$ref: "#/channels/payments.settled"
bindings:
kafka:
bindingVersion: 0.5.0
groupId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- billing
- notifier
clientId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- billing-1
- notifier-1
x-kurkik:
kafka:
operation:
groupId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- billing
- notifier
clientId:
$schema: http://json-schema.org/draft-07/schema#
enum:
- billing-1
- notifier-1
security: []
consumerConfiguration: {}
groupConfiguration: {}
send_customers.updated:
action: send
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}
send_orders.created:
action: send
channel:
$ref: "#/channels/orders.created"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}
send_payments.settled:
action: send
channel:
$ref: "#/channels/payments.settled"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}

Download source.yaml

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 1 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group audit --consumer-property client.id=audit-1 --consumer-property group.protocol=consumer --include 'orders.created' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name audit --alter --add-config consumer.heartbeat.interval.ms=6000
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group billing --consumer-property client.id=billing-1 --include 'orders.created|payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server a-kafka-1:9092 --group nightly-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name notifier --alter --add-config consumer.session.timeout.ms=50000

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 1 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server b-kafka-1:9092 --group legacy-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group invoicing --consumer-property client.id=invoicing-1 --include 'payments.settled' & # stays connected while kurkik reads

Sync

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092
kurkik conn add kafka b --bootstrap b-kafka-1:9092
kurkik kafka export a --acls --groups --stdout > a.yaml # source.yaml
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run # plan.txt (and -o json: plan.json)
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --yes # apply.txt, and the rollback: rollback.yaml
kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt
Show the plan
$ kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run
Sync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qk
owns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (3)
~ set group audit consumer.heartbeat.interval.ms (not set) -> 6000
Group audit is not on the cluster: Kafka keeps its settings by id, and the group appears when a consumer joins it, with no committed positions.
~ set group notifier consumer.session.timeout.ms (default) -> 50000
- delete group legacy-report [deletes the group's committed positions]
legacy-report's 1 committed position(s) go with it; the rollback commits them again. Its own settings stay with Kafka.
note: Group sync: Kafka holds no group without members or committed positions. A group the document describes is made by writing its own settings, which Kafka keeps by the group's id; the group itself appears only when a consumer joins it, and starts with no committed positions - its consumers begin where auto.offset.reset says. No position is ever copied from the document's cluster. A group with nothing of its own to write cannot be made at all. With --delete, empty groups the document does not describe are deleted with their positions; the rollback commits those again (Kafka then makes it a classic group until a consumer of another protocol joins).
left alone (14)
not decided customers.updated groupId
Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_customers.updated' declares no consumer group, so there is nothing a broker could confirm.
not decided customers.updated action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'customers.updated', so operation 'send_customers.updated' is not checked.
not decided orders.created action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked.
not decided payments.settled action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked.
not held group audit groupId
Kafka keeps no group without members or committed positions, so audit itself is not made: its own settings are written (below), and it appears when a consumer joins it, with no committed positions.
not held group billing groupId
Kafka keeps no group without members or committed positions, and billing sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
in use group invoicing groupId
invoicing has 1 member(s) connected. sync deletes only a group nobody is in.
not held group nightly-report groupId
Kafka keeps no group without members or committed positions, and nightly-report sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
and 6 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; ALTER_CONFIGS on GROUP audit; ALTER_CONFIGS on GROUP notifier; DELETE on GROUP legacy-report
3 changes, 1 destroy - 1 still differs
rehearsal
[?] not attempted delete group legacy-report
not rehearsed: it has no validate-only form
[+] done set group audit consumer.heartbeat.interval.ms (not set) -> 6000
[+] done set group notifier consumer.session.timeout.ms (default) -> 50000
The cluster would accept every request it was shown. 1 could not be rehearsed - Kafka has no validate-only deletion or ACL change, and a schema registry no validate-only write. Nothing was changed.
exit 2

Download

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 3 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 3 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group audit --consumer-property client.id=audit-1 --consumer-property group.protocol=consumer --include 'orders.created' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name audit --alter --add-config consumer.heartbeat.interval.ms=6000
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group billing --consumer-property client.id=billing-1 --include 'orders.created|payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server a-kafka-1:9092 --group nightly-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name notifier --alter --add-config consumer.session.timeout.ms=50000

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 3 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 3 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server b-kafka-1:9092 --group legacy-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group invoicing --consumer-property client.id=invoicing-1 --include 'payments.settled' & # stays connected while kurkik reads

Sync

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092,a-kafka-2:9092,a-kafka-3:9092
kurkik conn add kafka b --bootstrap b-kafka-1:9092,b-kafka-2:9092,b-kafka-3:9092
kurkik kafka export a --acls --groups --stdout > a.yaml # source.yaml
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run # plan.txt (and -o json: plan.json)
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --yes # apply.txt, and the rollback: rollback.yaml
kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt
Show the plan
$ kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run
Sync a.yaml into b - Apache Kafka, cluster MkU3OEVBNTcwNTJENDM2Qk
owns: the whole cluster - the document names no x-kurkik.kafka.server.topicPrefixes; access, as x-kurkik.kafka.server.acl declares it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (3)
~ set group audit consumer.heartbeat.interval.ms (not set) -> 6000
Group audit is not on the cluster: Kafka keeps its settings by id, and the group appears when a consumer joins it, with no committed positions.
~ set group notifier consumer.session.timeout.ms (default) -> 50000
- delete group legacy-report [deletes the group's committed positions]
legacy-report's 1 committed position(s) go with it; the rollback commits them again. Its own settings stay with Kafka.
note: Group sync: Kafka holds no group without members or committed positions. A group the document describes is made by writing its own settings, which Kafka keeps by the group's id; the group itself appears only when a consumer joins it, and starts with no committed positions - its consumers begin where auto.offset.reset says. No position is ever copied from the document's cluster. A group with nothing of its own to write cannot be made at all. With --delete, empty groups the document does not describe are deleted with their positions; the rollback commits those again (Kafka then makes it a classic group until a consumer of another protocol joins).
left alone (14)
not decided customers.updated groupId
Nothing about this can be checked against the system, so sync cannot bring it into line. Operation 'receive_customers.updated' declares no consumer group, so there is nothing a broker could confirm.
not decided customers.updated action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'customers.updated', so operation 'send_customers.updated' is not checked.
not decided orders.created action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'orders.created', so operation 'send_orders.created' is not checked.
not decided payments.settled action
Nothing about this can be checked against the system, so sync cannot bring it into line. A broker cannot know who publishes to 'payments.settled', so operation 'send_payments.settled' is not checked.
not held group audit groupId
Kafka keeps no group without members or committed positions, so audit itself is not made: its own settings are written (below), and it appears when a consumer joins it, with no committed positions.
not held group billing groupId
Kafka keeps no group without members or committed positions, and billing sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
in use group invoicing groupId
invoicing has 1 member(s) connected. sync deletes only a group nobody is in.
not held group nightly-report groupId
Kafka keeps no group without members or committed positions, and nightly-report sets nothing of its own to write ahead. It appears when a consumer joins it; sync copies no position.
and 6 differences sync does not act on - servers, messages, undeclared settings; kurkik kafka diff shows them
applying needs: DESCRIBE and DESCRIBE_CONFIGS on the topics it reads; ALTER_CONFIGS on GROUP audit; ALTER_CONFIGS on GROUP notifier; DELETE on GROUP legacy-report
3 changes, 1 destroy - 1 still differs
rehearsal
[?] not attempted delete group legacy-report
not rehearsed: it has no validate-only form
[+] done set group audit consumer.heartbeat.interval.ms (not set) -> 6000
[+] done set group notifier consumer.session.timeout.ms (default) -> 50000
The cluster would accept every request it was shown. 1 could not be rehearsed - Kafka has no validate-only deletion or ACL change, and a schema registry no validate-only write. Nothing was changed.
exit 2

Download

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --replica-assignment 2,2 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --replica-assignment 1:3 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group audit --consumer-property client.id=audit-1 --consumer-property group.protocol=consumer --include 'orders.created' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name audit --alter --add-config consumer.heartbeat.interval.ms=6000
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group billing --consumer-property client.id=billing-1 --include 'orders.created|payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server a-kafka-1:9092 --group nightly-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server a-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-configs.sh --bootstrap-server a-kafka-1:9092 --entity-type groups --entity-name notifier --alter --add-config consumer.session.timeout.ms=50000

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --replica-assignment 2,2 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --replica-assignment 1:3 --config cleanup.policy=compact
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group notifier --consumer-property client.id=notifier-1 --consumer-property group.protocol=consumer --include 'payments.settled' & # stays connected while kurkik reads
kafka-consumer-groups.sh --bootstrap-server b-kafka-1:9092 --group legacy-report --topic orders.created:0 --reset-offsets --to-offset 0 --execute
kafka-console-consumer.sh --bootstrap-server b-kafka-1:9092 --group invoicing --consumer-property client.id=invoicing-1 --include 'payments.settled' & # stays connected while kurkik reads

Sync

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092,a-kafka-2:9092,a-kafka-3:9092
kurkik conn add kafka b --bootstrap b-kafka-1:9092,b-kafka-2:9092,b-kafka-3:9092
kurkik kafka export a --acls --groups --stdout > a.yaml # source.yaml
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --dry-run # plan.txt (and -o json: plan.json)
kurkik kafka sync a.yaml b --groups --overwrite --delete --accept-groups --yes # apply.txt, and the rollback: rollback.yaml
kurkik kafka sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt

All flags: kurkik kafka sync · more Apache Kafka sync examples