Creating and Deleting the Topics

How to Create and Delete Topic in Kafka using Ubuntu?

Please make sure that Zookeeper and Kafka server are running.

Getting Started

I) Creating Topics

kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic first_topic --create --partitions 3 --replication-factor 1

Check the list of topics created.

kafka-topics.sh --zookeeper 127.0.0.1:2181 --list

Get more information on a specific Topic

kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic first_topic --describe

Creating a second Topic

kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic second_topic --create --partitions 6 --replication-factor 1

Deleting the topic

  1. List all topics

kafka-topics.sh --zookeeper 127.0.0.1:2181 --list

2. Delete the topic

kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic second_topic --delete

→ by default the delete.topic.enable is set true.

3. Verify the deletion

kafka-topics.sh — zookeeper 127.0.0.1:2181 --list

Summary: You have learned to Create and Delete the Topic.

I am Full Stack Java Developer @ Tata Strive | Get blogs and tutorials related to the (React | Kafka | DevOps) | Follow me on LinkedIn https://www.linkedin.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Grunt Interview Questions

5 Ways High School Students Can Learn Coding For FREE ✨

3D ListView in Flutter

How I Boosted My Coding Speed and Productivity with AI

Journey to Google Summer of Code 2021

How to Learn Web Development

Daily Developer Log 2022/05/11

DORAGONLAND AMA RECAP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sagar Kudu

Sagar Kudu

I am Full Stack Java Developer @ Tata Strive | Get blogs and tutorials related to the (React | Kafka | DevOps) | Follow me on LinkedIn https://www.linkedin.com

More from Medium

How to Dockerize Spring Boot Application

Elasticsearch Search API: Are You Getting CORS?

Custom Pagination with Spring Data and MongoDb

How to unlock Kubernetes REST API and link it to Swagger UI