Listing Kafka Topics

Listing Kafka Topics

Learn how to list all kafka topics using the command line. In this quick tutorial, we're going to see how we can list all topics in an Apache Kafka cluster. First, we'll set up a single-node Apache Kafka and Zookeeper cluster. Then, we'll ask that cluster about its topics.

1. Overview

In this quick tutorial, we're going to see how we can list all topics in an Apache Kafka cluster.

First, we'll set up a single-node Apache Kafka and Zookeeper cluster. Then, we'll ask that cluster about its topics.

2. Setting Up Kafka

Before listing all the topics in a Kafka cluster, let's set up a test single-node Kafka cluster in three steps:

  • Downloading Kafka and Zookeeper
  • Starting Zookeeper Service
  • Starting Kafka Service

First, we should make sure to download the right Kafka version from the Apache site. Once the download finishes, we should extract the downloaded archive:

$ tar xvf kafka_2.13-2.6.0.tgz

Kafka is using Apache Zookeeper to manage its cluster metadata, so we need a running Zookeeper cluster.

For test purposes, we can run a single-node Zookeeper instance using the zookeeper-server-start.sh script in the bin directory:

$ cd kafka_2.13-2.6.0 ## extracted directory$ ./bin/zookeeper-server-start.sh config/zookeeper.properties

This will start a Zookeeper service listening on port 2181. After this, we can use another script to run the Kafka server:

$ ./bin/kafka-server-start.sh config/server.properties

After a while, a Kafka broker will start. Let's add a few topics to this simple cluster:

$ bin/kafka-topics.sh --create --topic users.registrations --replication-factor 1 \  --partitions 2  --zookeeper localhost:2181$ bin/kafka-topics.sh --create --topic users.verfications --replication-factor 1 \  --partitions 2  --zookeeper localhost:2181

Now that everything is ready, let's see how we can list Kafka topics.

cloud kafka cloud computing

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Multi-cloud Spending: 8 Tips To Lower Cost

Mismanagement of multi-cloud expense costs an arm and leg to business and its management has become a major pain point. Here we break down some crucial tips to take some of the management challenges off your plate and help you optimize your cloud spend.

What are the benefits of cloud migration? Reasons you should migrate

To move or not to move? Benefits are multifold when you are migrating to the cloud. Get the correct information to make your decision, with our cloud engineering expertise.

Clearing the air by debunking The Myths associated with Cloud Computing

Cloud computing is a one-stop solution to what can be the biggest problems for businesses in the future, i.e., storage of data. Therefore, whether your company belongs to the private or public sector, you should consider including cloud computing...

Best Cloud Computing (AWS) Development Company

Develop highly scalable apps on Amazon Cloud Services in India. Mobile App Development India Offers Amazon cloud web services (AWS) for app development, database storage solution, hosting solution etc.

How Cloud Technology Reduces your App Development Cost? - TopDevelopers.co

Learn about the positive impact of cloud computing on mobile app development, and how it will help reduce your app development cost.