Skip to content

Instantly share code, notes, and snippets.

@chadmcrowell
Last active January 2, 2023 21:27
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save chadmcrowell/0fd333251037b1bb57e0df223b4ac90b to your computer and use it in GitHub Desktop.
Save chadmcrowell/0fd333251037b1bb57e0df223b4ac90b to your computer and use it in GitHub Desktop.
Topic Tools
# Create a topic if a topic with the same name does NOT exist
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--create \
--topic topic-1 \
--replication-factor 1 \
--partitions 3 \
--if-not-exists
# Alter the number of partitions (can only go up)
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--alter \
--topic topic-1 \
--partitions 7
# Delete a topic (this is irreversible)
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--delete \
--topic topic-1
# List all topics
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--list
# Describe all the topics at once
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe
# Identify any overrides to topics (configs added to the defaults)
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--topics-with-overrides
# Topics that are not in-sync with all replicas
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--under-replicated-partitions
# Topics without a leader replica
bin/kafka-topics.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--unavailable-partitions
# Describe the configurations for all topics (only in addition to the defaults)
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--entity-type topics
# Describe the configurations for a specific topic (defaults will not show)
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--describe \
--entity-type topics \
--entity-name topic-1
# Change the topics message retention
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--alter \
--entity-type topics \
--entity-name connect-test \
--add-config retention.ms=3600000
# Describe the configurations for all brokers (defaults will not show)
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--entity-type brokers \
--entity-default \
--describe
# Describe the configuration for broker 0 (defaults will not show)
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--entity-type brokers \
--entity-name 0 \
--describe
# Add a custom config to broker 0 that will change it's log cleaner thread count
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--entity-type brokers \
--entity-name 0 \
--alter \
--add-config log.cleaner.threads=2
# Remove all custom configs (not including defaults) from broker 0
bin/kafka-configs.sh --zookeeper zookeeper1:2181/kafka \
--entity-type brokers \
--entity-name 0 \
--alter \
--delete-config log.cleaner.threads
@chadmcrowell
Copy link
Author

chadmcrowell commented Jun 19, 2019

Click here to go back to the Kafka Deep Dive Interactive Diagram: https://lucid.app/lucidchart/556d9075-a316-4d40-b5dc-225c4353d1e8/view

@bridany
Copy link

bridany commented Sep 7, 2022

Diagram is incomplete
some pages are missing, or the next button fails
for example Section2 /Data Delivery stops on page integrity

@chadmcrowell
Copy link
Author

@bridany so sorry about this. The diagram has been relocated. here's the link: https://lucid.app/lucidchart/556d9075-a316-4d40-b5dc-225c4353d1e8/view

@bridany
Copy link

bridany commented Sep 8, 2022

thanks for the fast feedback

unfortunately the issue remains

@chadmcrowell
Copy link
Author

@bridany unfortunately I am unable to edit the diagram. Can you reach out to support@acloud.guru or go to https://help.acloud.guru/hc/en-us/requests/new and let them know that this diagram needs maintenance? Thanks!

@chadmcrowell
Copy link
Author

@bridany I have also done this on your behalf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment