Skip to content

Instantly share code, notes, and snippets.

@isopropylcyanide
Last active September 3, 2021 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isopropylcyanide/933867326bae4d43bcc7f35b4461e29c to your computer and use it in GitHub Desktop.
Save isopropylcyanide/933867326bae4d43bcc7f35b4461e29c to your computer and use it in GitHub Desktop.
connector-lostevent-kafka-reset-offset.sh
# Find the partition for the connector (server name is the key) that stores its latest offset. Let that be p
$ kafkacat -b localhost -C -t <connect.offsets.storage.topic> -f 'Partition(%p) %k \n %s\n'
# Sample output where the connector has stored offsets till 46242 and we've missed from 42000-45000
# Partition <p>
# ["my-db-connector",{"server":"server.key"}]
# {"ts_sec":,"file":"mysql-bin.000038","pos":46242, "row":1,"server_id":121,"event":3}
# Write a poison pill message: NULL to that partition. This essentially means to clear offsets
$ echo '["my-db-connector",{"server":"server.key"}]|' \|
kafkacat -P -Z -b localhost -t <connect.offsets.storage.topic> -K \|
-p <partition: p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment