Skip to content

Instantly share code, notes, and snippets.

@dmerrick
Last active July 15, 2019 19:28
Show Gist options
  • Save dmerrick/9296f0bc7a882cb3e0544ceaf3139106 to your computer and use it in GitHub Desktop.
Save dmerrick/9296f0bc7a882cb3e0544ceaf3139106 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
env="stage"
region="us-west-2"
old_group="webhooks_"
new_group="webhooks"
topic="fulfillment-events"
kafka_ns="team-fleet"
kafka_cluster="kafka-fulfillment-client"
kafka_url="${kafka_cluster}.${kafka_ns}.svc.${env}.${region}.aws.k8s:9092"
#execute="--execute"
execute="--dry-run"
######################
kafka-consumer-groups --bootstrap-server ${kafka_url} --describe --group ${old_group} | \
grep "${topic}" | \
awk '{print $2, $3}' | \
sed \
-e "s/ / --reset-offsets --to-offset /" \
-e "s/^/kafka-consumer-groups --bootstrap-server ${kafka_url} --group ${new_group} ${execute} --topic ${topic}:/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment