Skip to content

Instantly share code, notes, and snippets.

View wojtek-oledzki's full-sized avatar

Wojtek Oledzki wojtek-oledzki

View GitHub Profile
@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 14, 2024 10:32
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@ralph-tice
ralph-tice / gist:bc8f66c4fe1d4238ce54c54272fc4ba2
Last active April 1, 2020 10:03
Resizing a Kafka cluster via bash
#!/bin/bash -xe
# requires jq and 3 brokers to start
which jq || echo 'no jq found, bye!' && exit 1
ZK_HOST=zkhost1:2181/kafka
# record all topics
/usr/local/kafka/bin/kafka-topics.sh --zookeeper $ZK_HOST --list > all_topics
# generate json for listing which topics to reassign