Skip to content

Instantly share code, notes, and snippets.

@tomaszprasolek
Created June 1, 2025 12:24
Show Gist options
  • Save tomaszprasolek/ac15bfc5bb7d6203f305745427965f5e to your computer and use it in GitHub Desktop.
Save tomaszprasolek/ac15bfc5bb7d6203f305745427965f5e to your computer and use it in GitHub Desktop.
Kafka CLI commands
/opt/bitnami/kafka/bin$
kafka-topics.sh --bootstrap-server localhost:9092 --create --topic dlq-test-performance --partitions 3 --replication-factor 3 --config retention.ms=2419200000
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name dlq-test-performance --alter --add-config retention.ms=2419200000
${KAFKA_HOME}/bin/kafka-topics.sh --create --zookeeper ${ZOOKEEPER_NAME}:2181 --replication-factor ${REPLICATION_FACTOR} --partitions 1 --topic ${t} --if-not-exists
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic aaa-tomo-test --partitions 3 --replication-factor 3 --if-not-exists
kafka-configs --bootstrap-server localhost:9092 --entity-type topics --entity-name aaa-tomo-test --describe --all
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --describe --all
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --alter --add-config 'delete.topic.enable=true'
kubectl exec --stdin --tty shell-demo -- /bin/bash
kafka-server-start.sh config/server.properties --override delete.topic.enable=true
docker cp "D:\CSHARK\Projekty\Bash-scripts\create-topics-for-DFS.sh" e1200ac5e1c0:/opt/kafka/bin/
--------------------------------------------
https://stackoverflow.com/a/58293572
kafka-topics.sh --bootstrap-server localhost:9092 --topic aaa-tomo-test --describe
kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic aaa-tomo-test --partitions 2 --replication-factor 2
---------------
https://stackoverflow.com/questions/37960767/how-to-change-the-number-of-replicas-of-a-kafka-topic
---------------------------------
https://docs.confluent.io/platform/current/kafka/post-deployment.html
Note that Kafka does not currently support reducing the number of partitions for a topic.
-------------------------
kafka-reassign-partitions.sh --bootstrap-server localhost:9092 --reassignment-json-file kafka_replicas.json --execute
kafka-topics.sh --bootstrap-server localhost:9092 --topic aaa-tomo-test --describe
-----------------------------------
https://strimzi.io/blog/2022/09/16/reassign-partitions/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment